Panama was about 90 seconds from beating the United States and advancing to a playoff against New Zealand for a World Cup berth.
The fans at Estadio Rommel Fernandez in Panama City were ready to start a nationwide celebration.
And then the Americans stunned not just an opponent, but an entire country.
Graham Zusi and Aron Johannsson scored in second-half stoppage time, giving United States a 3-2 victory Tuesday night that left Mexico's hopes alive and knocked out the Panamanians.
"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. clinched a World Cup berth last month and didn't use most of its regular starters. Gabriel Torres put Panama ahead in the 18th minute in a downpour. But Michael Orozco tied the score in the 64th minute, just seven seconds after Costa Rica took a 2-1 lead at home against Mexico.
Luis Tejada scored in the 83rd, putting Panama back into fourth place and the playoff berth. Mexico, which last missed the World Cup in 1990, would have been eliminated.
But Zusi scored 1:24 into three minutes of stoppage time, deflating a crowd anticipating a celebration. Zusi has three international goals, including two in five days, and his first was at Panama in January 2012.
"I don't know what it is. Must be something in the water," he said.
Johannsson, a 22-year-old who made his American debut in August, added his first international goal at the 2:40 mark to seal the U.S. win and Panama's elimination.
"They pushed everyone forward. Some of them just stopped playing," Johannsson said. "I don't know what happened. It seemed like they just gave up."
The Americans, who have lost only once in their past 16 games, tied their best of 22 points in the hexagonal, the final round of the North and Central American and Caribbean region.
"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."
It was a similar finish to four years ago, when Jonathan Bornstein's goal in the fifth minute of stoppage time at RFK Stadium in Washington, D.C., gave the U.S. a 2-2 tie against Costa Rica, giving a World Cup berth to Honduras and knocking out the Costa Ricans.
The U.S. (7-2-1) and Costa Rica (5-2-3) already had clinched berths last month, and Honduras (4-3-3) earned the region's final automatic spot with a 2-2 tie at last-place Jamaica (0-5-5).
Mexico (2-3-5) finished fourth with 11 points, three ahead of Panama (1-4-5), which has never reached soccer's top event. Before allowing the stoppage-time goals, Panama was even with El Tri on points and goal difference and would earned the playoff berth based on a 10-7 advantage in goals scored.
Having clinched its seventh consecutive berth last month, the U.S. was without many of its regulars because of either injuries or decisions to allow them to return to their clubs. Among the missing were Landon Donovan, Clint Dempsey, Michael Bradley, Jermaine Jones, Tim Howard, Omar Gonzalez and Matt Besler.
In the absence of Dempsey and Howard, Jozy Altidore captained the national team for the first time.
"It was an opportunity for us to see some players stepping in," Klinsmann said,
Panama got the early goal when Marcos Sanchez sent a layoff to the top of the penalty area, and Torres split the defenders and easily beat goalkeeper Brad Guzan with a one-timed shot to the corner.
Orozco scored his third international goal off a Davis corner kick. Sacha Kljestan was hauled down by Luis Henriquez right in front of the goal, allowing the ball to fall to Orozco. With his back toward the goal, Orozco lifted his left leg and made just enough contact to score from 6 yards.
Panama could have been awarded a penalty kick two minutes later, but Jamaican referee Courtney Campbell didn't whistle Alejandro Bedoya for knocking over Alberto Quintero as he streaked into the penalty area. Two minutes later, Guzan got his left hand up to stop a point-blank shot by Torres.
Panama came back when Torres sent the ball down the right flank to Roberto Chen, who went to the endline and sent a low cross through the penalty area. Guzan slapped the ball with his right hand and the ball ricocheted to Tejada, who stepped in front of Kyle Beckerman and knocked it in.
But it wasn't over. Edgar Castillo started the setup to the tying goal with a pass to Davis, who crossed to Zusi, He climbed over Henriquez and his 8-yard header beat goalkeeper Jaime Penedo.
With Panama pressing to get the goal it needed to regain the lead, Terrence Boyd fed Johannsson for a 20-yard shot.
"They wouldn't have done anything different if they were in our shoes," midfielder Kyle Beckerman said. "They would have tried to beat us. A couple of their guys were asking us to take it easy on them, but it's about competition. The USA is guaranteed to be in the World Cup, but who's in that team, nobody knows, so we had to try and turn the result around so it looked good on us."