Two superb goals from Pedro Mendes, the second in injury time, gave Pompey their first league win of the year.
Mendes celebrates his first goal for Pompey
After a scrappy first half the hosts went in front when Mendes thumped a 25-yard drive past David James.
Pompey were good value for their lead but lost it when Richard Dunne headed Joey Barton's corner past Dean Kiely.
The hosts piled forward and found a dramatic winner when Mendes hammered virtually the last kick of the match into the net from more than 25 yards.
Portsmouth went into the match without a win in eight games and their lack of confidence was self-evident in an opening 15 minutes dominated by City.
The hosts eventually found their rhythm with Andres D'Alessandro knitting things together in midfield but Gary O'Neil was unable to capitalise on their first real opening.
Lomana LuaLua's near-post cross picked out O'Neil but the captain couldn't direct his stooping header on target.
City responded with a near miss from Barton.
The midfielder, back from suspension, was given time and space to shoot from 20 yards but screwed his shot wide.
The temperature rose markedly midway through the half when Jordan appeared to go in with his studs up on Mendes.
The Pompey midfielder was clearly hurt but referee Mark Halsey, who sent off Arjen Robben for a two-footed lunge last week, ruled both players challenged fairly for the ball.
The incident stirred up the hosts who enjoyed their best spell of the half, with Dunne and Jordan intervening to cut out crosses from D'Alessandro and Brian Priske respectively.
But when Portsmouth's best chance came, six minutes before the interval, Benjani Mwaruwari was unable to take it.
The Zimbabwean, without a goal since his £4.1m January move from Auxerre, pounced on a weak punch from James but slashed wildly over the bar.
Pompey were clearly encouraged by their first-half display and began the second period in positive fashion.
James clawed away a LuaLua cross and watched Benjani's shot sail wide but could do nothing about Mendes' spectacular strike.
City could only half clear D'Alessandro's corner and when the ball dropped to Mendes 25 yards out the Portuguese drove into the bottom corner past a stationary James.
But Pompey had not kept a clean sheet since December and their failure to find a two-goal cushion eventually cost them.
Barton's corner was headed into the danger zone by Micah Richards and helped on by Samaras for Dunne to nod home from close range.
The goal stung Portsmouth back into action and LuaLua and Todorov both went close before Mendes again struck.
He collected the ball 30-yards out and crashed a swerving drive into the top corner in the third minute of injury-time to give Pompey hope in their fight against the drop.
Portsmouth manager Harry Redknapp:
"If we didn't win today we were dead and buried. It has given the players a lift and the fans a lift.
"It's going to be hard but you can only keep going and what today's result has done is keep us in there.
"It was no more than Pedro Mendes deserved because he was fantastic today.
"He hits balls like that in training. He's been doing it all week and we said 'save one for Saturday Pedro', well he saved two!"
Manchester City boss Stuart Pearce:
"We lacked a cutting edge up front and it cost us.
"We could have been a lot more cute. The game finished up end to end because both teams wanted the three points but we should have changed our formation a bit.
"The goals we conceded I don't think my defenders could do anything about it. The lad finished well although we might have challenged better outside the area."
Portsmouth: Kiely, Priske, Primus, O'Brien, Taylor, O'Neil, Pedro Mendes, Davis (Routledge 88), D'Alessandro, LuaLua, Mwaruwari (Todorov 63).
Subs Not Used: Ashdown, Karadas, Koroman.
Goals: Pedro Mendes 60, 90.
Man City: James, Jihai, Dunne, Richards, Jordan (Ireland 75), Sinclair (Croft 45), Reyna (Wright-Phillips 69), Barton, Musampa, Vassell, Samaras.
Subs Not Used: Weaver, Thatcher.
Goals: Dunne 83.
Referee: M Halsey (Lancashire).