Rotherham had controlled the first 20 minutes but failed to cash in and Swindon found their feet to run out comfortable victors.
Alex Revell and Ben Pringle went close before defender Pablo Mills produced a header from Pringle’s corner but it was tipped onto the bar by Wes Foderingham.
Rotherham keeper Scott Shearer denied Jay McEveley but Alex Pritchard, on loan from Spurs, hit a 25-yard free kick to put Swindon in front.
Seconds before half-time Swindon doubled their lead when Massimo Luongo’s persistence paid off and he cracked a shot that hit Lee Frecklington and the ball looped over the keeper.
Pritchard clipped in a low ball for Nicky Ajose to slot in the third after 65 minutes and in added time a mistake by Pringle forfeited possession and sub Dany N’Guessan broke into the box and slid home the fourth.