Blues looked set to maintain their Barclays Premier League status when lifelong Birmingham fan Craig Gardner equalised Roman Pavlyuchenko's opener with a sublime strike in the 79th minute.
But Wolves' second goal of their 3-2 defeat at Blackburn meant Birmingham needed to win to survive and as they surged forward in injury time, Pavlyuchenko raced up the other end and fired a 20-yard shot past Foster that went in off the bar to seal the midlanders' relegation.
Beauty: Roman Pavlyuchenko curls in the opening goal
The result, and Liverpool's defeat at Aston Villa, means that Spurs will join Birmingham in the Europa League.
Questions will now be asked of Birmingham manager Alex McLeish's future after his team's form suffered a dramatic slump that started after February's Carling Cup final win over Arsenal.
Owner Carson Yeung, who will make the decision of whether to dispense with the Scot or not, watched on as his side were made to endure a nervyopening 45 minutes amid a tense atmosphere in north London.
Feeling blue: Barry Ferguson (left) and Roger Johnson (right) react after Pavlyuchenko's strike
Blues had the first chance of the game through Keith Fahey, who fired into Carlo Cudicini's arms, but otherwise the visitors were on the back foot throughout the half.
Barry Ferguson appeared to use his arm inside his own box but referee Mark Clattenburg waved play on before Ben Foster saved well to keep Sandro out with two efforts in quick succession.
Peter Crouch then fired just wide from 18 yards before he just failed to get on the end of Danny Rose's whipped cross.
On the road to Europe: Tottenham players celebrate Pavlyuchenko's strike
The away fans cheered loudly twice as news filtered through that fellow relegation candidates Blackpool and Wolves had gone behind and Yeung afforded a mild grin from the directors' box.
His team still had a big task on their hands as Spurs pushed for the opener.
Aaron Lennon skipped into the box after playing a brilliant one-two withYounes Kaboul but Curtis Davies kept his cool to tackle the England winger inside the box.
All for one: Alex McLeish gives instructions to his Birmingham City players
Crouch clashed heads with Davies as he went up for a challenge, the balldropped to Defoe and he drew another save out of Foster.
In a rare Birmingham attack, Liam Ridgewell forced Kaboul off the ball and delivered a low cross that Cudicini gathered at the second attempt.
Crouch, clearly affected by his clash with Davies, came off for Pavlyuchenko in the 39th minute as Spurs looked to grab an opener just before the break, but it did not come despite Kaboul's fierce shot from 20 yards.
Up for it: Birmingham fans in full voice before the game
Birmingham fans' spirits were high at the start of the second half as their team looked on course to stay up but they soon had their heads in their hands when Pavlyuchenko opened the scoring with a superb 25-yard curler.
The Russian picked the ball off Danny Rose, took a touch and whipped a brilliant shot that beat Foster at his far post.
Ridgewell's studs sunk into Sandro's calf and he earned a booking as Yeung cut an unimpressed figure in the stands.
Blue nun: Birmingham fans turned to fancy dress for inspiration
Spurs looked for a second and they almost got it when Jermain Defoe raced past three Birmingham defenders before Davies blocked his shot with a brave header.
Tottenham were playing some excellent football, with Modric, Lennon and Sandro all showing off their skills to demonstrate the gulf in class between the two sides.
Gardner wrestled the lively Rose to the ground to earn a booking as the travelling fans looked on miserably.
False dawn: Birmingham looked like staying up as Craig Gardner scored
Blackpool's second goal at Old Trafford put Birmingham second bottom, destined for the drop, but McLeish's side were failing to test Cudicini.
The Scot barked orders from the sidelines knowing an equaliser would keep his team up at that point and they responded by surging forward before Roger Johnson headed a brilliant opportunity wide.
Dawson cleared a Jerome cross from five yards before the England defender denied Keith Fahey with a good challenge inside the box momentslater.
1-1: Gardner (right) celebrates the equaliser
Lennon skinned Johnson before delivering a cross to Tom Huddlestone, whohalf-volleyed wide as the game entered a nail-biting final quarter.
McLeish, who cut an anxious figure on the touchline, brought on Matt Derbyshire for Sebastian Larsson with 16 minutes left.
The Birmingham manager and their travelling fans were sent into ecstasy with 12 minutes left when a Jean Beausejour corner found its way to Craig Gardner and he smashed a strike through a crowded penalty area past Cudicini.
The midfielder raced over to celebrate in front of the delirious away support but Wolves' second goal at Molineux meant that Blues dropped into the bottom three on goals scored.
The news filtered through to McLeish who urged his players on to score a winner they needed to stay up.
Three minutes of injury time were added and Foster came forward for a corner, but the cross sailed through the box and Spurs survived.
Pavlyuchenko raced up the other end and with 15 seconds of play and his strike flew in off the bar, sealing Birmingham's demise.
?Survival Sunday live - how the relegation dogfight unfolded in the Barclays Premier LeagueWatch all the Premier League goals every week on our brilliant video playerAll the latest Tottenham news, features and opinionAll the latest Birmingham news, features and opinion
?Explore more:People: Craig Gardner, Roman Pavlyuchenko Places: Birmingham
Source: Daily Mail
Source: Daily Mail