The visitors were a goal up after just 27 seconds when Jordan Rhodes cut in from the left and beat Jamie Annerson with a curling shot from just inside the box.
And although Rotherham equalised in the 11th minute when Ryan Taylor scored his first of the season, firing home from Nicky Law’s corner, the visitors were just too good for their Yorkshire neighbours.
Rhodes tapped in his second of the night at the far post in the 23rd minute after Annerson had got his fingertips to Graham Carey’s shot from the left.
And five minutes later 17-year-old Arsenal loanee Benik Afobe netted his first career goal, the England Under-19 starlet nodding in at the far post from Rhodes’ left-wing cross.
Town increased their lead eight minutes after the break when Afobe could have shot but instead pulled the ball back perfectly for Scott Arfield to net an unmissable chance.
And Afobe added his second and Town’s fifth in the 73rd minute, running on to substitute Joe Garner’s pass and taking the ball around Annerson before firing into the empty net.
Ryan Cresswell’s injury-time header for Rotherham was no more than a consolation.