Rotherham captain Richard Wood struck during extra time for The Millers to snatch victory from Shrewsbury in what was a thrilling clash at Wembley.
It was another impressive performance from Williams who created chance after chance for Rotherham after being introduced in the 75th minute.
The Perth product was unlucky not to have scored an incredible winner in the final seconds of regulation but he was denied by an incredible save by Shrewsbury shot stopper Dean Henderson.
Rotherham missed a golden chance to take an early lead after David Ball's penalty kick was saved by Henderson, but the Yorkshire side did edge in front through Wood in the 32nd minute.
Shrewsbury upped the tempo after the break, and netted a deserved leveller in the 58th minute through Alex Rodman, who finished off a well-worked free kick.
Neither side could find a winner in normal time, but Wood stepped up again 13 minutes into extra time to secure Rotherham an immediate return to the English second tier after relegation in 2016-17.