Mexico have escaped with a spot in a two-legged play-off to qualify for Brazil 2014, despite losing 2-1 to Costa Rica on Tuesday.
Manuel Vucetich's Mexico side looked set to miss their first World Cup finals in 24 years as Panama, their rivals for the intercontinental play-off berth against New Zealand, took a crucial lead over the United States.
But Mexico's arch-rivals, the USA, did them a favour, scoring twice in second-half injury-time to stun Panama 3-2 and ensure the loss in Costa Rica did not matter for Vucetich's team.
The results on the final matchday of CONCACAF's fourth round of World Cup qualifying saw Mexico finish with 11 points in fourth position, three clear of Panama, who would have earned the play-off berth on goals scored if they had defeated the USA.
The match at the Estadio Nacional de Costa Rica began in scrappy fashion with neither team fashioning a genuine chance on goal in the opening quarter of an hour.
But Mexico were in danger of missing out on the World Cup for the first time since 1990 and that knowledge seemed to spark the visitors, who were denied a goal in unusual circumstances after 17 minutes.
A great move through midfield saw Carlos Pena slide a pass to Oribe Peralta on the right side of the box and the striker squared the ball to Javier Hernandez, who scuffed his shot towards goal.
With Costa Rica's goalkeeper Keilor Navas stranded, Hernandez's effort rolled slowly towards the goal-line but Peralta, who was offside, looked set to slam the ball into the net before thinking better of it, letting it through his legs to nestle in the corner of the net.
Despite Peralta having not touched the ball, the referee whistled for offside.
The visitors were denied again soon after with Pena's shot blocked by a diving Costa Rica defender, before the hosts dealt Mexico a blow in the 25th minute when Bryan Ruiz slammed home the opening goal after spinning away from two defenders.
With Panama taking the lead over the USA in the other crucial CONCACAF qualifier, Mexico were in trouble but equalised quickly when Peralta thumped a loose ball into the net off the underside of the crossbar after Navas had denied Hernandez.
Mexico dominated the rest of the half but failed to convert and that lack of cutting edge came back to haunt them in the 65th minute when Cristian Gamboa's cross found Alvaro Saborio unmarked in the penalty area and the Real Salt Lake striker made no mistake with his header.
Almost immediately, Costa Rica goalkeeper Guillermo Ochoa palmed away Raul Jimenez's header as Mexico searched for another equaliser, although they seemed safe as the USA equalised in Panama.
Costa Rica then hit the post as Cristian Bolanos played a one-two with Saborio but could only dink his shot onto the woodwork and the ball bounced out.
With around seven minutes remaining, Panama moved 2-1 ahead of USA but Mexico failed to respond and were on the verge of elimination until two late goals by the Americans ensured Vucetich's team will play New Zealand in a two-legged play-off in November.
Meanwhile, Honduras confirmed their place at Brazil 2014 despite playing out a disappointing 2-2 draw at last-placed and winless Jamaica.
|Coach: J. Pinto|
for B. Ruiz 49'
for Y. Tejeda 72'
for J. Campbell 77'
|Aulas: Lyon should be awarded win after Metz clash is abandoned|
|Emery: PSG must learn from defeat|
|Marotta: Best to laugh at Pogba comments|
|Mourinho: I´m bringing back Manchester United DNA|
|De Boer: Nobody in charge at Inter|
|Chapecoense to be named Copa Sudamericana champions - Tozzo|
|Bilic: We are in a relegation fight|
|Aubameyang: I don´t know if I´ll be at Dortmund next season|
|Goals will return for Higuain, says Allegri|
|Southgate hopes to convince Zaha to play for England|
|Simeone will go to Inter, says son Giovanni|
|Watford fan dies after falling ill during West Brom clash|
|Simeone marvels at ´almost perfect´ Espanyol defence|
|Gestifute publishes ´Ronaldo tax compliance´|
|Marquinhos urges PSG to forget defeat|
|Tributes paid at Arena Conda memorial after Chapecoense tragedy|
|Juventus 3 Atalanta 1: Alex Sandro stunner helps Allegri´s side return to winning ways|
|Atletico Madrid 0 Espanyol 0: Simeone´s men fail to capitalise on rivals´ slip-ups|
|Metz-Lyon abandoned after Lopes hurt by firecracker|
|Wenger hails ´classy´ Sanchez after 14-minute hat-trick|
|´A big humiliation´ - Bilic slams West Ham´s lack of dedication|
|´Can always count on Serge´ - Bale reacts to El Clasico|
|Modric: Clasico draw feels like a win|
|Record-breaking Leipzig back on top thanks to Kolasinac own goal|
|West Ham 1 Arsenal 5: Sanchez hat-trick sends Gunners second|
|Fellaini: Mourinho more fun than Van Gaal|
|Hughes delighted with Muniesa and Walters impact|
|Goal-shy Messi failing to fire in Clasico clashes|
|Late Clasico draw has little bearing on title race - Zidane|
|Iniesta defends Arda after clumsy foul costs Barca Clasico win|
|Pardew wants Palace to build on Southampton win|
|Mazzarri slams referee Scott after Watford loss|
|´Barca very far off looking like champions´ - Luis Enrique frustrated by Clasico collapse|
|Conte: Chelsea players did well to remain calm|
|Forget Ronaldo - Ramos proves he is Madrid´s ultimate big-game player with Clasico heroics|
|Barcelona were the better team in El Clasico - Suarez|
|Ranieri accepts Leicester face relegation battle|
|Abuse in British football: Chelsea´s statement of apology in full|
|Conte admits Chelsea got lucky|
|Chelsea issue ´profuse apology´ to Johnson following sex abuse claims|
|Reus and Dembele catch Tuchel´s eye in ´complete´ Dortmund performance|
|Montpellier 3 Paris Saint-Germain 0: Visitors miss chance to go top|
|Tottenham needed a big victory - Pochettino|
|´I don´t know if it´s a fair result´ - Ramos accepts Real Madrid rode their luck|
|Barcelona 1 Real Madrid 1: Ramos snatches Clasico point to keep Zidane´s side in control of title ra|
|West Brom 3 Watford 1: Pulis´ men climb into top six|
|Sunderland 2 Leicester City 1: Moyes´ men make it three wins in four|
|Tottenham 5 Swansea City 0: Kane celebrates new deal with brace|
|Crystal Palace 3 Southampton 0: Benteke double and Saints gifts boost Pardew|
|Stoke City 2 Burnley 0: Hughes´ men continue strong run with straightforward win|
|Setback puts Butland injury return on hold|
|Borussia Dortmund 4 Borussia Monchengladbach 1: Aubameyang at the double as Tuchel´s men run riot|
|We had enough chances to win - Guardiola|
|Costa breathes sigh of relief as De Bruyne and Man City misfire|
|Manchester City 1 Chelsea 3: Blues complete brilliant turnaround in Etihad thriller|
|Sevilla miss chance to pile pressure on Clasico rivals with shock loss|
|´It´s not like we´re playing Real Madrid´ - Spalletti confident Roma can beat Lazio|
|Spanish authorities to take ´appropriate´ steps after Ronaldo tax evasion allegations|
|Inter´s Ranocchia sees room for improvement|
|A League Review: City play out feisty Roar draw after FFA Cup exploits|
|Nainggolan has no regrets over failed Chelsea move|
|Arsenal to make decision on Cazorla future in January|
|Bacca has no case to answer for Sevilla trip - Montella|
|Fabregas returns to Chelsea´s XI|
|Ronaldo is no genius like Messi - Capello|
|Everything is wonderful with Boateng - Rummenigge|
|Wenger to drop Jenkinson to protect him from social media taunts|
|Sakho not part of Liverpool´s first-team plans|
|Hughes offers Hitzfeld Stoke invite after Shaqiri comments|
|Roberto Carlos: Ronaldo is the best in the world, still!|
|Robben hopeful of finalising Bayern future|
|Sarri talks up Balotelli to Napoli|
|Everton need time and changes, says Koeman|
|Ancelotti lauds Muller after Bayern win|
|Sterling: I have more freedom under Guardiola|
|Mourinho: Maybe no Premier League title for United this season|
|Bayern laid down a marker - Rummenigge|
|Conte ´maybe the best in the world´ - Guardiola|
|Pioli laments Inter´s ´step backwards´|
|Ronaldo and Mourinho ´fully compliant´ with tax obligations, insists Gestifute|
|Napoli 3 Inter 0: Pioli dealt emphatic first Serie A defeat|
|Mainz 1 Bayern Munich 3: Lewandowski double inspires champions|
|´I have found my luck at Leipzig´ - Hasenhuttl dismisses Arsenal talk|
|Messi better to watch than Ronaldo, says Saviola|
|´I don´t care about age´ - Klopp committed to promoting youngsters|
|Koeman: Ibrahimovic was fantastic at 19|
|Pulis not letting court decision tarnish Palace memories|
|Carroll to make West Ham return against Arsenal|
|Real Madrid must win LaLiga and end Barca dominance - Roberto Carlos|
|Barcelona v Real Madrid: Zidane´s men eye LaLiga supremacy|
|Costa discipline issues in the past - Conte|
|A-League review: Melbourne Victory held by Perth Glory|
|I deserve criticism if Dortmund´s players do - Tuchel|
|Emery wants Cavani to dethrone Ibrahimovic|
|Martial is happy again, says Mourinho|
|Guardiola wary of Costa and Pedro|
|Messi, Ronaldo and Griezmann to battle it out for FIFA award|
|Conte reveals admiration for Guardiola philosophy|
|Mourinho: Schweinsteiger can stay at Man Utd|
|Conte: It is a pity Chelsea sold De Bruyne|
|Carrasco now competing with Griezmann and Gameiro - Simeone|
|Luis Enrique: Clasico not decisive in title race|
|Barcelona have no weaknesses - Zidane|
|Zidane: Ronaldo´s hunger for success key for Real Madrid|
|Barcelona midfielder Iniesta back for Clasico|
|Higuain does not need Dybala to score - Allegri|
|Summerbee: Chelsea blew it with De Bruyne|
|Ranieri, Zidane and Santos up for FIFA coach award|
|Chelsea paid me £50,000 to prevent child abuse revelations - Johnson|
|Vertonghen signs new Tottenham deal|
|Klopp hopeful on Lallana and Firmino|
|Ozil: Arsenal can win Champions League with a bit of luck|
|Sturridge exit a non-story, says Klopp|
|Debuchy out for up to six weeks|
|Pardew ready to turn around slumping Palace|
|Arsenal will not sign Cazorla replacement - Wenger|
|Courtois not getting carried away over Chelsea form|
|CAS to rule on Blatter case on Monday|
|Ozil refuses to rule out Real Madrid return|
|Sterling: I am keeping away from certain stuff I was doing last year|
|Leverkusen´s Volland out until 2017|
|Aloisi rules out Roar swoop for Keane|
|Pele reflects on ´sad moment´ of Chapecoense tragedy|
|Southgate urges downtime responsibility from England|
|Ranieri: Leicester signings not to blame for poor form|
|Sky is the limit for ´special´ Donnarumma, says Hart|