After a quiet start, Robins debutant Smith rose highest to meet a corner in the seventh minute, but he headed over the crossbar.
Just before the half-hour mark, Smith drew first blood for Swindon, firing home from inside the box.
Shrewsbury pulled a goal back on the stroke of half time, courtesy of Paul Parry's long-range free kick.
Midway through the second half, Robins keeper Wes Foderingham had to throw himself to his right to push a powerful Shrews effort onto the woodwork.
The home side regained the advantage in the 89th minute when Ranger headed home from close range.
In injury time, the Robins made sure of the victory, with Ranger turning provider to assist Smith for his second of the game.