Crewe slumped to their third home defeat of the season as goals from Danny Jackman, Adebayo Akinfenwa and Abdul Osman made the difference at Gresty Road.
Akinfenwa's 64th minute penalty proved to be turning point in the game after Crewe had hit back to level through Tom Pope.
When Mark Little tumbled in the box under Billy Jones' challenge, it was the assistant referee who signalled for the penalty which the Nigeria striker struck into the right-hand corner of the goal.
It was no more than the Cobblers deserved against a poor Crewe side.
Stuart Gray's men looked more incisive and confident on the ball in a first half of few chances.
Karl Hawley's snapshot on the turn was one of the few moments when either keeper was tested.
But when Michael O'Connor tripped Liam Davis just outside the penalty area, Jackman stepped up and curled an exquisite free-kick over the wall into the top corner for the opener.
Crewe enjoyed the best spell of the game in a frantic period after the re-start which saw Pope's angled drive blocked by Frank Fielding, who then clawed back on-loan centre-half Dennis Lawrence's looping header from underneath the bar.
When Jones hit an excellent long cross from the left, Pope flicked it up and dinked it over Fielding to restore parity.
But Crewe were level for only nine minutes as Akinfenwa converted from the spot, before Osman was gifted a free header from a Jackman corner to set the seal on the victory.