Craig Bellamy's superb flicked volley won a pulsating game for Newcastle.
The home side took a early second-half lead through Laurent Robert's free-kick after a Paul Bosvelt foul and Alan Shearer's penalty made it 2-0.
Shaun Wright-Phillips' fine individual goal - a drilled shot - put City back in the game and Robbie Fowler tied the match at 2-2, scoring from the spot.
Robbie Elliott's header made it 3-2 before Wright-Phillips shot home again, only for Bellamy to have the final say.
Before Sunday's game, City had not conceded a goal in their previous two League games but the way they conceded four goals suggested manager Kevin Keegan is some way from resolving the club's defensive problems.
If the first half was distinctly uninspiring, the second period was anything but.
Early in the second-half, Shearer finally escaped the shackles of the City defence when he got above Danny Mills only to direct his header over the bar.
Soon after Shearer's miss Newcastle took the lead through a free-kick after Bosvelt had fouled Nicky Butt.
Robert slipped as he hit the ball but his delivery was good enough to zip over the City wall to leave James stranded.
Just before the hour mark, James was picking the ball out of the net again after he was exposed by Steve McManaman's defensive lapse.
McManaman carelessly gave the ball away, allowing Carr to break away into the box.
Carr skipped to the right of James, whose flailing hand sent the Newcastle right-back tumbling.
As James dived to his right from the resulting penalty, Shearer thumped the ball the other way into the roof of the net.
City's first recovery was sparked on 64 minutes by Wright-Phillips' well-taken goal after he was picked out by Mills.
Wright-Phillips skipped away from Elliott and drilled the ball past Shay Given.
Three minutes later Fowler was tripped by Butt in the penalty area and the City striker himself calmly sent the Newcastle goalkeeper the wrong way from the spot.
Having worked so hard to get back into the game, City again found themselves behind on 69 minutes.
Elliott flicked on Robert's free-kick and, after his header hit the post, Dunne was unable to clear the danger and the ball trickled over the line.
Wright-Phillips' unerring eye for a goal rescued City for a second time when Newcastle failed to clear and the England international drilled the ball home.
But Newcastle refused to settle for a draw and after good work by Olivier Bernard on the left, Bellamy cleverly juggled the ball before flicking a volley past James in the 89th minute.
Newcastle: Given, Carr (Hughes 59), Elliott, O'Brien, Bernard, Jenas, Butt, Bowyer, Robert (Milner 71), Shearer, Bellamy (Ameobi 90).
Subs Not Used: Harper, Ambrose.
Booked: Bernard, Butt.
Goals: Robert 49, Shearer 58 pen, Elliott 69, Bellamy 89.
Man City: James, Mills, Distin, Dunne, Thatcher, Shaun Wright-Phillips, Bosvelt, McManaman, Sibierski, Macken (Flood 58), Anelka (Fowler 45).
Subs Not Used: Waterreus, Negouai, Jordan.
Booked: Bosvelt, McManaman, Mills.
Goals: Shaun Wright-Phillips 64, Fowler 67 pen, Shaun Wright-Phillips 77.
Att: 52,316.
Ref: S Dunn (Gloucestershire).