Andy Kirk's 23rd minute strike handed John Gorman his first win as Northampton boss and made it three defeats in a row for beleaguered Gillingham.
After a scrappy opening to the game, Northampton were the first to threaten when Chris Doig met Andy Holt's free-kick with a firm header, only to see his effort fly over the bar.
Gillingham began to find some rhythm thanks to the industrious Andrew Crofts but fell behind in the 23rd minute.
Debutant goalkeeper Darren Randolph could only fumble a cross into the path of Jason Crowe who returned the ball to James Quinn 10 yards out. Quinn's shot was blocked by Brent Sancho's outstretched leg, but the ball fell invitingly to Kirk, who tapped home from close range.
The Cobblers almost snatched a second minutes later when Kirk found himself through on goal, only to be pulled back by Ian Cox as he attempted to shoot. The referee saw differently however, as Kirk's protests fell on deaf ears.
Gillingham stirred themselves into life and almost levelled when Croft's powerful header form a Matt Jarvis cross was brilliantly kept out by Mark Bunn. From the resulting corner, Crofts again rose highest but could only direct his header wide.
The second half followed a similar pattern to the first as both sides became careless in possession. After 67 minutes Gary Mulligan found space in the area following a Dean McDonald back-heel, but his shot failed to test the goalkeeper.
Gillingham threw on substitute Guylain Ndumbu-Nsungu in an effort to salvage a point and he almost repaid them after latching onto Michael Flynn's through ball, before volleying just over.
The Congolese star found himself in a shooting position again moments later, but screwed his shot wide of Mark Bunn's left-hand post from an angle.
The Cobblers appeared content to hold onto their lead and showed little in the way of attacking urgency as the game wore on. Gillingham, however, lacked the imagination and inventiveness to open up their opponents and created little else of note.
The final whistle triggered a crescendo of boos from the home fans as boss Ronnie Jepson was left to ponder a third successive defeat.