Middlesbrough defender Chris Riggott made a dramatic return from a loan spell with Stoke City.
After being involved in Stoke's Championship promotion challenge, Riggott answered an emergency call to set Middlesbrough on the road to Premier League survival.
Riggott, whose last appearance at the Riverside Stadium was six months ago, scored with a vital header in the first half to help Boro on the way to a double over the FA Cup finalists.
At the final whistle, Middlesbrough could celebrate safety and look forward to their tenth consecutive season in the Premier League with all the financial rewards of top-flight status.
Mark Schwarzer returned in goal for the home side, but David James was again absent for Portsmouth with Jamie Ashdown deputising for the England keeper.
Portsmouth looked the more dangerous in the early stages of the game against a nervy home side.
Yet Middlesbrough made the first scoring attempt with Ashdown saving well from Afonso Alves.
Pompey hit back and Milan Baros shot over with a scoring chance, while Lassana Diarra was prominent in early Portsmouth attacks.
Middlesbrough needed to provide a greater sense of urgency with so much at stake.
The team responded to vocal support with Stewart Downing heading wide and Alves shooting wide from just inside the penalty area.
Glen Johnson tried a 25-yard shot for Portsmouth but his effort was easily collected by Schwarzer, who had a relatively easy 90 minutes.
Five minutes before the break came the all-important breakthrough as Fabio Rochemback sent over a right-wing corner and Riggott gave Ashdown no chance with a firm header.
Just before the interval, Diarra was booked for a foul
Two minutes after the break, Julio Arca was shown the yellow card for pulling an opponent's shirt.
Middlesbrough piled on the pressure at this stage and the tireless Sanli Tuncay gained some reward for his performance with a headed goal from a right-wing Downing corner.
Visiting fans chanted "We are going to Wembley" and after the break it looked as though the Pompey players had one eye on the FA Cup Final.
There was a penalty appeal when Jermain Defoe hit the deck but the referee waved on play.
Middlesbrough held on for a vital three points and can now plan for another season with the big boys.