Needing a win to guarantee their safety, Sunderland went ahead through Kenwyne Jones just before the hour mark but Portsmouth hit back immediately through John Utaka.
An own goal by Sunderland defender Phil Bardsley and Armand Traore's late goal confirmed Portsmouth's victory.
Newcastle, who are third from bottom, have 34 points with Hull City above them on 35 and Sunderland on 36, setting up a nailbiting final matchday of the season.