Steven Taylor headed Newcastle to Barclays Premier League safety as 10-man Birmingham's woes increased at St James' Park.
The Carling Cup winners had defender Liam Ridgewell controversially dismissed for deliberate handball 10 minutes before the break to spark a madcap and ultimately decisive flurry of activity.
Shola Ameobi converted the resulting penalty to give the Magpies the advantage and when Taylor powered home a second from Joey Barton's corner, the game looked to be over. However, Lee Bowyer marked his return to Tyneside with a 45th-minute strike, which went in off Fabricio Coloccini's leg, to give the visitors hope.
But the margin of victory would have been far greater had it not been for the heroics of City keeper Ben Foster, who made stunning saves from Peter Lovenkrands, Nile Ranger and Kevin Nolan twice to keep his side in it to the whistle.
Victory took Newcastle to 44 points and left Birmingham on 39 and while the former can now start planning for next season, there is still work to be done for the West Midlanders.
The game kicked off with both sides knowing a win would effectively end their relegation fears, and equally aware that a draw would not be the worst result, and for much of the opening 45 minutes, the game reflected that reality.
There was little action of note as defences dominated with Ameobi and Lovenkrands seeing little of the ball at one end and lone striker Cameron Jerome, his physical battle with Taylor aside, finding himself equally under-employed.
Indeed, neither keeper had a save of any consequence to make until Foster got down well to turn away Barton's skidding 30-yard drive with 17 minutes gone.
But the end-of-season feel evaporated in an explosive final 10 minutes of the half.
The visitors found themselves under the cosh as the Magpies launched a sustained assault with old boy Stephen Carr clearing Ameobi's header off the line and Foster pulling off a fine save to keep out Coloccini's follow-up.
The Argentinian reacted first to head over Foster only for Carr to intervene once again.
However, as the ball fell towards Nolan, Ridgewell nudged it clear with his arm and referee Chris Foy pointed straight to the spot before producing a red card.
Ameobi waited patiently while Ridgewell made his feelings clear, and then calmly tucked the penalty into the bottom corner for his ninth goal of the season.
The 10 men might have been dead and buried long before the break had Foster not made fine reaction saves to deny first Lovenkrands and then Nolan, but there was nothing he could do to keep out Taylor's towering 43rd-minute header, which Sebastian Larsson could only help into his own net.
But Newcastle contrived to hand the visitors a lifeline on the stroke of half-time when Coloccini misjudged a long clearance to allow Jerome in.
The Argentinian and Taylor got back well to halt the striker's progress, but when he fed the ball to Bowyer, his shot ended up in the back of the net via a deflection off Coloccini.
Full-back Jose Enrique fizzed a 35-yard drive just wide of Foster's right post within two minutes of the restart as the Magpies attempted to kill off the game, and Ameobi headed over seven minutes later when he might have done better.
However, it took a good block by Taylor seconds later to deny Bowyer a second, and keeper Tim Krul had to save as the midfielder got in a second attempt from the rebound.
Birmingham were coping well with their numerical disadvantage, although they were aided by some lacklustre play from the hosts.
Nolan was unable to direct a 64th-minute volley at goal, although Taylor's header arrived at a difficult height, and Cheick Tiote fired well wide seconds later with the home side stepping up a gear.
But for Foster, the scoreline would have assumed ugly proportions for Alex McLeish, the keeper plucking Nolan's goal-bound 74th-minute header out of the air and then making an even better save from substitute Ranger three minutes later.
Roger Johnson cleared Ameobi's 88th-minute chip off the line, but it was all to no avail as the Magpies claimed the points with Tiote's record-equalling 14th booking of the season the only disappointment.