The Blues were twice hauled in by the promotion contenders at Fratton Park before Ben Close’s winner 24 minutes from time served notice of the Blues’ own third-tier ambitions.
Ronan Curtis’ goal after just 33 seconds set Pompey’s team on the way before summer Pompey target Freddie Ladapo got the first of his two goals in the 15th minute.
John Marquis grabbed his fifth goal of the season seven minutes before the break but Oli Hawkins’ foul on Carlton Morris allowed Ladapo to level 17 minutes after the restart.
But up stepped Close four minutes later with a trademark finish from outside the box to lift his side to 10th - just two points outside the play-offs.
Denver Hume: Portsmouth's expensive forgotten man and why former Sunderland defender really could be one for the future
'We wanted to show him a bit of love' - Portsmouth-based Spurs fans' terrific gesture to ensure Dane Scarlett feels at home on the south-coast
League One latest: Portsmouth linked duo set for Oxford United and Lincoln moves, Southampton prospect joins Blues rivals as Ipswich land former Blackpool and Derby veteran
Danny Cowley offers update on Portsmouth's forgotten man and ex-Sunderland full-back sidelined for five months
'Real driving force... lion-hearted display... classy presence' - Neil Allen's Portsmouth ratings from 3-0 Carabao Cup win at Cardiff
The result in front of a crowd of 16,355 also makes it just one defeat in 12 and four wins on the bounce for Kenny Jackett’s men.
It was a dream start for unchanged Pompey as Curtis broke the deadlock with the game’s first attack.
The Irishman confidently advanced from Ryan Williams’ pass and delivered a sumptuous finish from the edge of the box which flew into the top corner.
The visitors responded well, however, and were level in the 15th minute as Craig MacGillivray failed to hold Kyle Vassell’s free-kick and Ladapo applied the close-range finish.
The keeper partially atoned for that error 12 minutes later as Ladapo was put clear but fired at the Scot.
Pompey restored their lead eight minutes before the break as Lee Brown crossed and Ellis Harrison headed to Marquis who fired home with the Rotherham defence appealing for offside.
The striker should have had a second in stoppage time but headed at Daniel Iversen with the goal at his mercy from Curtis’ cross.
The pace of the game continued after the break but it was the vistiors who levelled from the spot in the 62nd minute as Oli Hawkins caught Carlton Morris in the box and Ladapo sent MacGillivray the wrong way from 12 yards.
But Close put the Blues back in front four minutes later, with the goal of course coming from outside the box as he fired home through the bodies from 20 yards.
And there was no late disappointment for Pompey this time as they saw out the win to send the Fratton faithful home happy.