Northampton moved off the bottom of the League Two table despite a late fight-back by Bristol Rovers.
Adebayo Akinfenwa put the hosts ahead after just two minutes with a cool finish, before he poked home his second of the evening from close range.
Kelvin Langmead headed home Ben Tozer's cross to make it 3-0, only for Craig Stanley to nod home at the far post.
Matt Duke upended Mustapha Carayol to allow Lee Brown to fire home from the spot, but the Cobblers held on.
VIEWS FROM THE DRESSING ROOM.
Northampton Town manager Aidy Boothroyd told BBC Radio Northampton:
"You've got to put your foot on the ball, stick on the game plan and be calm in the chaos - and we weren't.
"But I thought we scored three really good goals and we deserved to be in front. Adebayo Akinfenwa took his goals well and he deserves all the plaudits.
"There were some individual performances that weren't up to scratch today but when you play poorly and win, you can accept it."
Bristol Rovers manager Mark McGhee told BBC Radio Bristol:
"They looked like a team that had something to play for, and we didn't.
"Regardless of how the goals came about, it was more about the general attitude and I thought that we were off it. They looked like a team who had set themselves up well.
"We looked like a team who were a little bit uncertain about stopping them in the first 20 minutes and we were punished for it.
"The second half we found a lot more energy and tempo and all we could do in the second half was recover a bit of pride and I think we did."