Brentford ended a depressing run of only one win in seven games with their first ever victory at the Sixfields Stadium.
The Bees were 2-0 up inside 25 minutes through Senegalese-born defender Ibrahima Sonko and striker Rowan Vine - his fifth goal of the season.
Sonko opened the scoring in the seventh minute when he rose unmarked to head in a free-kick by Kevin O'Connor and Vine netted at the second attempt after his first shot had been parried by Cobblers goalkeeper Lee Harper.
Delighted Bees boss Wally Downes said: "I was pleased with the way we defended in the main, apart from the one blip at the end.
"I always had faith in the side during our recent bad run and I believe that if you produce the performances the points will take care of themselves."
This was far from a classic, with Brentford able to sit back with the cushion of their early advantage while the home side made few inroads into protecting a recent run of only one defeat in five games.
It wasn't until injury time that Northampton were able to get on to the scoresheet when their two substitutes combined. Jamie Forrester slipped the ball through for Derek Asamoah to run on to, and having beaten the offside trap he poked his shot past Paul Smith.
Smith had earlier made two outstanding saves on the rare occasions when Northampton managed a clear sight on goal.
He was at his most alert in the 18th minute when Paul Rickers crossed for Marco Gabbiadini to get goal side of Leo Roget, only to see Smith parry his fierce drive.
And it was Smith again to the rescue 12 minutes after the restart when he denied Chris Hargreaves' 12-yard volley after Daryl Burgess had nodded down a Paul Harsley free-kick