Adam Rooney broke the deadlock for the visitors in the 77th minute from the penalty spot after Yeovil goalkeeper Marek Stech had felled Gary Roberts. Substitute James Collins doubled the lead in the final minute of second half injury time after racing clear in a Swindon break-away.
The defeat dents Yeovil's automatic promotion hopes as they slip to seventh in the table.
However, the hosts looked lively in the early stages of a cagey first half in Somerset. Joe Edwards hit a shot over the Swindon crossbar and James Hayter skewed a volley over after controlling expertly with his head.
The match was hindered by a bobbly, weathered pitch and numerous fouls. Referee Keith Stroud was forced to book four players in the first half alone.
Swindon improved after the break. Gary Roberts saw a goal from a free-kick disallowed for a foul he committed in the build-up.
Nathan Thompson was a rock in Swindon's defence, twice thwarting the lively Yeovil attacker Paddy Madden with some brilliant defending.
Stech, formerly of West Ham United, made an excellent athletic save to deny Collins as the game entered its latter stages. Collins turned inside his man to bend a beautiful effort towards the bottom corner but was denied by the outstretched palms of Stech.
However, the 23-year-old goalkeeper caught Roberts on the edge of the penalty area when Roberts latched onto a long Swindon ball forwards and Stroud instantly awarded the Robins a penalty.
Rooney, on loan from Birmingham City, stepped up to cooly slot home for his sixth goal of the season.
As Yeovil poured forwards in search of a dramatic equaliser, they got caught on the break. Collins powered onto an excellent Alan McCormack pass to race into the penalty area and strike low past Stech.
The goal was the last kick of the game and Swindon celebrated a crucial win to climb within three points off league leaders Doncaster.