Luke Chambers got Northampton's first home win of the season in a scrappy tie, with Leon Britton red carded.
The Cobblers edged a hard-fought encounter
The Cobblers were in charge for long periods, but keeper Mark Bunn had to deny Rory Fallon, Tom Williams and Andy Robinson in a goalless first half.
On 55 minutes Chambers hit a stunning volley from David Hunt's long throw, his first goal for the club.
Lee Trundle and Robinson went close to equalising, before Britton's second yellow led to a harsh dismissal.
Northampton: Bunn, Bojic, Chambers, Doig, Crowe, Jess, Taylor, Hunt, Burnell (Watt 86), McGleish, Quinn (Kirk 73).
Subs Not Used: Dunn, Dyche, Gilligan.
Booked: McGleish, Bojic, Doig, Chambers, Crowe.
Goals: Chambers 55.
Swansea: Gueret, Tate, Iriekpen, Lawrence, Williams, Britton, MacDonald (Jones 71), Tudur-Jones, Robinson, Trundle, Fallon (Akinfenwa 59).
Subs Not Used: Oakes, Austin, Butler.
Sent Off: Britton (90).
Booked: Tate, Iriekpen, Britton.
Ref: P Crossley (Kent).