The hosts went ahead after three minutes as Matt Fish's long ball was misjudged by Cobblers goalkeeper Lee Nicholls and McDonald tapped in from close range on his first start since returning to the Priestfield.
After 18 minutes Northampton almost levelled as Clive Platt's effort was saved by Nelson, before Ben Harding's effort was blocked on the line.
In the 36th minute the Cobblers had an excellent chance to equalise, Chris Hackett beating Joe Martin and whipping in a right-wing cross, but Platt could only head wide.
The wet and windy conditions made for a tight encounter in the second half as neither side was able to fashion many clear-cut chances, both teams having to resort to long balls.
But Gillingham made sure of the points in the 84th minute as Weston latched onto a long ball and smashed into the bottom right corner off the post.
Elsewhere, Jacques Maghoma earned Burton a 1-1 draw at Oxford which sent his side into the top three for the first time this season.
The Brewers striker was given space to turn and fire in a low shot from 16 yards with 20 minutes remaining and cancelled out James Constable's opener.
Oxford gave a debut to 19-year-old goalkeeper Max Crocombe, who did well in the testing, blustery conditions.
Burton keeper Stuart Tomlinson produced a great reaction save after 33 minutes when Damian Batt had got round the visitors' defence to meet Adam Chapman's cross on the volley.
But Oxford went ahead when Constable marked his return from a four-match suspension by heading home.
The striker peeled away from the near post to nod in Tony Capaldi's corner five minutes into the second half for his 10th goal of the campaign.
But Maghoma levelled for Burton in the 70th minute with a nice finish for his side's first goal in their last four away games after a start to the year in which they had previously won all their games at home, and lost all of them away.
Billy Kee had the chance to grab a late winner for Burton, but sliced horribly wide.
- Sports & Recreation
- Clive Platt