After an even first half with neither goalkeeper under any real pressure, Rotherham got the break two minutes before half-time.
Crewe cleared the danger from Nicky Law’s corner but Marcus Marshall whipped in a second cross from the left and skipper Nick Fenton – still forward for the corner – drilled a low shot past Rhys Taylor from 10 yards out.
After 62 minutes Ajay Leitch-Smith scored an equaliser that should have been ruled out. Lee Bell threaded a ball through, and although Leitch-Smith was clearly offside he was allowed to go on a fire past a helpless Andy Warrington.
Rotherham got their reward with two more goals in a dramatic last six minutes as first, Adam Le Fondre added his 19th of the season getting to a Ryan Taylor knock down to lift the ball over the keeper and into the net with six minutes remaining.
And four minutes later Taylor broke clear on the right and lashed an absolutely unstoppable shot past Rhys Taylor.