Two goals in a seven-minute spell late in the first half all but condemned Luton Town to relegation to League Two and gave Northampton a first win in four games.
A penalty by Poul Hubertz and a header for teenage midfielder Alex Dyer on his full league debut outgunned a late consolation by Hatters striker Sam Parkin, who once spent a loan period at Sixfields.
The victory kept alive Northampton's remote chance of making the play-offs, but it also earned them a measure of revenge after two defeats at Kenilworth Road earlier in the campaign.
It was rough on Luton who enjoyed the lion's share of possession, but the visitors were guilty of some sloppy finishing which, combined with a series of excellent saves from Mark Bunn, kept them at bay.
The home side went in front in the 34th minute when Hubertz was hauled down by Sol Davis and the Danish striker picked himself up to convert the resulting spot-kick.
Seven minutes later a swinging cross from wide on the left by Daniel Jones was met by the head of Dyer which brought the youngster a red letter day.
Luton's series of chances began as early as the 13th minute when Parkin headed a Paul McVeigh cross over the bar and the same player was denied by a full-stretch stop by Bunn five minutes before the break.
The same pattern continued after the break when Calvin Andrew was guilty of two glaring misses, rolling a shot wide of the target when clear and also glancing a header wide with the goal at his mercy.
When substitute Darren Currie raced through on goal and blasted directly at Bunn, Luton must have known their number was up, although Parkin did finally slot home a last-minute consolation from close range.