A blistering second-half spell took the game away from Pompey who had levelled earlier in the half.
Portsmouth goalkeeper Gavin Bazunu came to their rescue early on as he denied Rarmani Edmonds-Green from close range after he looked certain to score.
He could do little about Rotherham’s 29th-minute opener as Wes Harding’s cross to the far post was headed in by former Pompey man Smith.
Portsmouth drew level after 49 minutes with Marcus Harness finding space on the edge of the box and finishing clinically into the bottom corner.
But the goal provoked a stunning response from Rotherham with three goals in seven minutes.
Smith netted his second with 55 minutes gone. He back-heeled home at the second attempt after Bazuna fumbled a shot from Ollie Rathbone.
Rotherham scored again after 60 minutes with skipper Richard Wood rising highest to power in Dan Barlaser’s free-kick.
Ben Wiles got in on the act in the 62nd minute to round off the scoring with a powerful finish from Mikel Miller’s pass.