Lee Holmes' cross-shot was the difference as Swindon extended their lead at the top of League Two to seven points at the expense of Northampton.
Holmes grabbed his first goal since rejoining the Robins on loan when his curling cross evaded everybody and bounced into the net.
Kelvin Langmead's knock-down was dragged well wide by Byron Webster in the dying moments for the visitors.
It was the closest either team came to a goal after Holmes's opener.
Cobblers defender John Johnson angered Robins boss Paolo di Canio and was booked for a robust challenge on Raffaele De Vita.
Paul Benson then saw yellow for a lunge on Johnson just moments later.
Swindon can be promoted to League One on Saturday if they beat Plymouth Argyle and other results go their way.
VIEWS FROM THE DRESSING ROOM
Swindon Town manager Paolo di Canio told BBC Points West:
"Obviously, the job is not done. But if they are worried we won't go up then they have to be negative people in life.
"It's obvious we could lose five games in a row and that the three teams behind us can win four games in a row.
"Maybe in five games time I'll be here looking like the worst joker in the world so I don't want to say anything too much.
"But I am arrogant - we're up. But I have to tell my players that the job is not yet done and I have to keep the attention very high."
Northampton Town manager Aidy Boothroyd told BBC Northampton:
"The wind wasn't the best and we didn't take advantage of the weather.
"I can't knock the spirit but what games like this show is - with the greatest of respect to Swindon - there are fine margins between being where we are to where they are.
"We've come a long way in a short space of time. It was a magnificent crowd to follow us and I'm just disappointed we couldn't give them anything to shout about.
"It wasn't a particularly good goal to win it, but you've got to take it on the chin and use it as a lesson."