Striker Paul Shaw snatched a winner against his old club as Chesterfield ended their three-match run without a league win.
Shaw got behind the Millers defence in the 28th minute and, after taking the ball past keeper Neil Cutler, he slid his shot into the empty net. The goal was just reward for an excellent performance by Chesterfield who dominated the entire 90 minutes.
The Spireites' Caleb Folan had a chance to score as early as the fifth minute from an Alan O'Hare free-kick but Rotherham central defender Ian Sharps made a timely inception.
Three minutes later Chesterfield opened the scoring after Rotherham messed up a free-kick. The hosts got the ball out to Paul Hall on the right flank and he beat defender Gregor Robertson before crossing for Folan to head in.
Rotherham hit back and were level just three minutes later. Midfielder Martin Woods smashed in a shot which was blocked but Will Hoskins followed up to score with a low shot as he registered his fourth goal of the season.
Kevan Hurst went close before Shaw grabbed the winner after being set up by the hard-working Folan.
Phil Picken and O'Hare both went close to adding to Chesterfield's tally and, in the second half, Folan was denied his second goal of the game after being sent clear by O'Hare.
The big striker was heading towards goal but Cutler charged out of his area and punched the ball away. The Rotherham keeper was yellow carded by the referee although the home team thought he should have been sent off.
Folan then sent in a header that was cleared off the line before Rotherham finally got their act together for the last 20th minute.
They switched to a three-man strikeforce and almost forced an equaliser. Hoskins twice went close in the closing stages but failed to hit the target with both his efforts.
Rotherham's last chance to force an equalizer came 13 minutes from time when Eugen Bopp tried his luck from 20 yards out but Barry Roche made a diving save.