Roy O'Donovan netted the crucial goal on 26 minutes after good work by Chris Hackett, a thorn in Cheltenham's side throughout the game.
Aidy Boothroyd's only worry may be that his side failed to add a second goal on a night when they were well on top of their opponents.
Bayo Akinfenwa and Luke Guttridge had chances to stretch the Cobblers advantage but they will travel to Cheltenham on Sunday evening in confident mood.
6,563 watched the action at Sixfields and the home support was described as 'brilliant' by Boothroyd.
"The goal was a wonderful move," added the Cobblers boss. "It was a solid, strong, good footballing performance."
Opposite number Mark Yates admitted his side had not been at their best but was happy to be only one goal down.
"I'm probably a happier man than Aidy right now," he said. "We took a bit of a battering."