One minute away from failing to qualify for the 2014 World Cup, Mexico received some unlikely help from their rivals to the north.
Mexico will play New Zealand for a spot in next year's World Cup despite losing 2-1 at Costa Rica on Tuesday night.
The Mexicans advanced to the home-and-home series when the United States rallied with two late goals to win 3-2 at Panama. That kept Mexico in fourth place at the conclusion of the CONCACAF final qualifying round with only 11 points, three ahead of Panama, which would have advanced by holding off the Americans.
The U.S. trailed 2-1 when Graham Zusi scored on a header in stoppage time. That sapped the life out of Panama, and Aron Johannsson scored the American's winner a minute later with the last kick of the game.
"It shows you how brutal football can be. For one side that's almost there, and then the other side is back in,'' U.S. coach Jurgen Klinsmann said. "Now obviously you feel for the people. You feel for an entire country.''
The U.S., which clinched a World Cup berth last month, didn't use most of its starters, and Gabriel Torres put Panama ahead in the 18th minute in a downpour at Panama City. Michael Orozco tied it the 64th minute, just as Costa Rica took a 2-1 lead at home against Mexico.
Luis Tejada scored in the 83rd, putting Panama within minutes of a fourth-place finish and a berth in next month's playoff against Oceania champion New Zealand. Mexico, which last missed the World Cup in 1990, would have been eliminated.
But Zusi scored 1:24 into three minutes of stoppage time, and Johannsson added his first international goal at the 2:40 mark, giving the U.S. a record-tying 22 points in the hexagonal.
"This is just how football writes these crazy, emotional stories, and you're in the middle of it, because we all felt all of a sudden when Graham scored that header that it was all quiet, silence, and you feel for them,'' Klinsmann said. "Maybe it's a little bit in my culture, in the German culture you never stop before the referee blows the whistle, because I have won many, many games in the last minute. And hopefully, we keep on winning more. But it was a very sad moment for all here in Panama. We understand that.''
Edgar Castillo started the set up to the tying goal with a pass to Brad Davis, who sent the ball to Zusi. He climbed over Henriquez and his 8-yard header beat goalkeeper Jaime Pemedo. It was his third international goal, and second in five days.
With Panama pressing to get the goal it needed to regain the lead, Terrence Boyd set up Johannsson for his first goal for the U.S. on a 20-yard shot.
The finish also pushed Panama to fifth place in the hex, and allowed Mexico to finish fourth and qualify for the playoff with New Zealand -- barely.
"We thought that we were out," Mexico striker Oribe Peralta said.
Mexico could be hard-pressed to beat the Kiwis and get to Brazil, especially if it can't find some offense. In 10 games, the Mexicans scored seven goals.
"We've got to reflect, and we have to do whatever it takes to make it to the World Cup," Peralta added. "Things are not working as we wish."
Shortly after the match, "Gracias USA" was trending on Twitter. US Soccer replied:
Goals by Brian Ruiz in the first half and Alvaro Saborio in the second gave Costa Rica the win. The Ticos already had qualified for Brazil 2014 and wound up second to the United States in the round.
Peralta scored in the 29th minute for Mexico, which won only two games in the 10-game finals.
Also Tuesday in CONCACAF qualifying, Honduras drew 2-2 with Jamaica to claim third place in the final round and clinch a spot at the World Cup.
Information from The Associated Press was used in this report.