It was only a third win of the year for the relegated side, who took a 10th-minute lead with their first chance when Jean-Francois Lecsinel netted from close range following a Michael Rose corner.
Rovers should have been level three minutes later but Dale Jennings missed an open goal after goalkeeper Phil Smith saved from Lucas Akins.
It needed an excellent one-handed save by Tony Warner to prevent Billy Bodin doubling the Town lead after 20 minutes.
Bodin was just wide with two more excellent efforts before Michael Timlin put Swindon 2-0 in front after 38 minutes with a fine 25-yard strike after a long clearance.
Aaron Cresswell was unlucky to see a long-range free-kick rebound off a post soon after the break as Tranmere looked to get back in contention. Adam McGurk just missed the target before Cresswell brought a good stop from Smith.