Match ends, Rotherham United 1, Cardiff City 3.
Rotherham remain only six points clear of the Championship drop zone as Cardiff enjoyed their biggest away win of the season to make it four matches unbeaten on their travels.
The Bluebirds scored three goals in 11 minutes as they moved up to 13th in the table.
Bruno Ecuele Manga headed home the first before Federico Macheda volleyed into the net from over his shoulder.
Conor McAleny drilled in a third before Danny Ward headed a late consolation.
The Millers are only one position above the bottom three, while Cardiff are over 10 points from the play-offs or relegation mix.
Rotherham's disappointment though was softened by Millwall's defeat at Middlesbrough, meaning they have not been dragged closer to danger after a first home loss in five.
On the back of a vital win against the Lions on Saturday, the hosts started well with Matt Derbyshire having a goal ruled out for offside.
Their positive opening was undone though as Cardiff secured victory with a quick-fire treble before the break.
Cardiff were forced to change goalkeepers at the interval, with Simon Moore coming on for the injured David Marshall, but Rotherham failed to force him into a save until the 76th minute.
Instead it was the Bluebirds who looked the likeliest to add to their lead, with home goalkeeper Adam Collin producing a fine double save to deny Aron Gunnarsson and then Alex Revell.
Ward headed home Hammill's cross five minutes later but it was scant consolation.
Rotherham boss Steve Evans: "We don't live in a false world here where we think we are going to come back from three goals down like Roy of the Rovers does.
"There's a key moment in the game where the goalkeeper spills it and the referee gives a foul when the DVD shows it wasn't a foul, so these are big decisions tonight.
"I'm not here defending my team based on decisions but decisions change games don't they? If the officials can't get simple decisions right then deary me, what are we supposed to do?"
Cardiff City manager Russell Slade: "We had to weather a little bit of a storm in the first 10 minutes. We did that and got the ball down, created some good opportunities and we took them.
"If you looked at the chances and opportunities, even in the second half, I thought it was a really good away performance. I thought we made the right decisions.
"Secondly we were ruthless in the final third when we had to be. I think it's a good sign going forward. When those opportunities came we took them and took them really well."
- 17NewtonSubstituted forHammillat 45'minutes
- 11GreenBooked at 85mins
- 27DerbyshireSubstituted forSammonat 59'minutes
- 1MarshallSubstituted forMooreat 45'minutes
- 5Ecuele Manga
- 14MachedaSubstituted forDoyleat 71'minutes
- 29RevellSubstituted forJonesat 86'minutes
- 3da Silva
- 40K Harris
- James Adcock
- Shots on Target
Second Half ends, Rotherham United 1, Cardiff City 3.
Attempt missed. Paul Green (Rotherham United) right footed shot from the left side of the box is high and wide to the right. Assisted by Ben Pringle with a cross following a corner.
Corner, Rotherham United. Conceded by Lee Peltier.
Substitution, Cardiff City. Kenwyne Jones replaces Alex Revell.
Paul Green (Rotherham United) is shown the yellow card for a bad foul.
Foul by Paul Green (Rotherham United).
Conor McAleny (Cardiff City) wins a free kick in the defensive half.
Foul by Conor Sammon (Rotherham United).
Simon Moore (Cardiff City) wins a free kick in the defensive half.
Goal! Rotherham United 1, Cardiff City 3. Danny Ward (Rotherham United) header from the centre of the box to the bottom right corner. Assisted by Adam Hammill.
Hand ball by Paul Green (Rotherham United).
Attempt saved. Adam Hammill (Rotherham United) left footed shot from the right side of the box is saved in the top centre of the goal. Assisted by Kári Arnason.
Corner, Rotherham United. Conceded by Bruno Ecuele Manga.
Attempt blocked. Danny Ward (Rotherham United) left footed shot from the centre of the box is blocked.
Ben Pringle (Rotherham United) wins a free kick in the defensive half.
Foul by Sean Morrison (Cardiff City).
Foul by Jack Hunt (Rotherham United).
Conor McAleny (Cardiff City) wins a free kick on the left wing.
Attempt saved. Alex Revell (Cardiff City) right footed shot from the right side of the box is saved in the centre of the goal.