Swansea head coach Steve Cooper hailed the impact of substitute Andre Ayew as the Ghana captain sent his team into the second round of the Carabao Cup.
Ayew appeared as a second-half substitute for his first Swansea appearance in 15 months and scored twice either side of an effort from George Byers.
Matt Warburton had given Sky Bet League Two side Northampton a shock lead, but Ayew rose from the bench to turn the tables.
It keeps Swansea unbeaten this season and they will play Cambridge United in round two.
"Andre had 30 minutes, two goals, was highly motivated, and had a good work ethic. It was good," said Cooper.
"That's exactly what we know he can do. He's come back into the club after the international break in very good condition and looks extremely motivated in training.
"Tonight was about giving him the right amount of minutes to help him get right back up to the fitness levels to play in the league campaign. It was a positive night in a number of ways."
Swansea huffed and puffed in the first half but could not break through and Northampton looked dangerous on the counter as Warburton twice went close.
He eventually fired the Cobblers ahead in the 61st minute, but Ayew was introduced straight after and helped Swansea to score three times in eight minutes.
First he headed past Northampton's Welsh goalkeeper David Cornell and then Byers fired home from the edge of the box.
Ayew wrapped it up with another header as he netted his first Swansea goals since May 2016.
Northampton manager Keith Curle said: "For 75 minutes I thought we showed good attitude and great application. We were very, very good for a team who are where we are.
"To get better and improve we have to have the mentality to play to the 95th or 96th minute.
"We made sure the players had a good understanding of what to do, but we gave the ball away too cheaply and you can't do that against a Championship side.
"It was a great experience for the boys and for 75 minutes they saw the results of what we've been working on in training."