The visitors led at the break thanks to a first goal from Jose Baxter, but three second-half goals from the hosts stunned David Weir's side on the day new owner Prince Abdullah bin Mosaad bin Abdulaziz Al Saud outlined his ambitious plans.
Tony McMahon served up an early scare for the Millers when he smacked a third-minute free-kick against the crossbar, but the hosts should have led after 10 minutes.
Lee Frecklington burst through the middle yet he scuffed his shot and Mark Howard saved easily then Rob Milsom headed wide from Frecklington's cross.
The breakthrough came nine minutes before the break as Baxter got the ball from a throw-in, turned his man and fired across goal, his shot creeping in on the far post.
However, the home side equalised six minutes after the re-start.
A long goal-kick was headed down on the edge of the area and Kieran Agard turned on the loose ball and fired an unstoppable shot past Howard.
Two more goals from the home side followed in the space of four minutes to turn the game on its head.
Substitute Daniel Nardiello was upended by McMahon after 71 minutes and referee Andy D'Urso immediately pointed to the spot with Nardiello duly obliging to convert.
Four minutes later Rotherham won the ball on the edge of the area, Alex Revell fed Milsom and this time the latter made no mistake by driving home under the diving Howard.
Source: PA
Source: PA