MANAUS, Brazil — The ball was barely past U.S. goalkeeper Tim Howard, and already he had thrown his hands to his head. On the sideline, Jurgen Klinsmann spun away as if he had seen a ghost. Up the field, Michael Bradley could only stare.
The United States had won, hadn't it? Hadn't it?
The celebration had been epic after Clint Dempsey, the team's captain, the man with the black eye and the broken nose and the swollen cheek, scored in the 82nd minute to put the Americans ahead and surely — surely — into the knockout round of the World Cup.
It was bedlam. It was overwhelming. It was historic.
But then, suddenly, the lead was gone.
Silvestre Varela's goal on a diving header off Cristiano Ronaldo's cross on the game's last play gave Portugal a 2-2 tie Sunday in the fifth minute of extra time, the latest goal in a group-stage game in World Cup history according to ESPN Stats & Info.
The U.S. team did not advance to the Round of 16. It will not get to skate into its final Group G game, against Germany.
Instead, it will live on the precipice between success and failure for another day. That was the cost of two lapses — one at the beginning of the game and one, brutally, at the end.
"We had one foot in the door," Howard said.
A victory would have guaranteed advancement for the Americans; now, the math is murkier.
Germany and the Americans both have four points, but the Germans have a better goal difference. Ghana and Portugal, who meet Thursday at the same time as the U.S.-Germany match, have one point apiece. A win over Germany on Thursday in Recife would be ideal. A tie would also let the U.S. advance. A loss plus a Portugal-Ghana tie would do the job, albeit in a less satisfying way.
This much is sure: A win Sunday would have made it all moot.
Klinsmann called it "a little bit of a bummer."
"Obviously we're disappointed, but at the end of the day you've got to look at the positives: We got a point," Dempsey said. "We put in a good performance. I thought we played better than the last game. I thought we moved the ball better. I thought we created more chances. Just unlucky."
After the team allowed a horrible early goal by forward Nani to fall behind, Jermaine Jones leveled the score in the 64th minute with a whistling shot from nearly 30 yards that left Beto, the Portuguese goalkeeper, flat-footed.
Then came Dempsey's finish with his stomach off a cross that seemed destined to go down in the annals of U.S. soccer history.
But Ronaldo, the FIFA world player of the year who had largely been neutralized, swung in a perfect cross from the right wing that Varela sent into the net with a powerful header.
Just as the Yanks were seconds from beating the odds and advancing from the "Group of Death" after just two games, Portugal, fourth in the world according to FIFA's ranking, rescued itself seconds from elimination.
"It's a respectable result," Portugal coach Paulo Bento said, perhaps understating how much his team needed to avoid a loss. "We know our position is quite difficult now."
Despite the last second gut punch there were positives for the American team:
• Jones' goal, a perfect strike from 28 yards according to official measurements, was his first for the national team since May 2012.
• The Yanks trailed at halftime for the 16th time in their World Cup history; this was the first time they earned even a draw.
• The scored twice without injured striker Jozy Altidore.
"It's tough, but it's just the way it goes," Dempsey said. "We're Americans. I think we like to do things the hard way."
The possibilities for the U.S. team heading into Thursday's game at noon against Germany.
If Americans win: They win Group G and face the Group H runnerup in the Round of 16.
If it's a tie: Germany and the U.S. both would have five points; Germany would be group winner on goal differential and the Americans advance to face the Group H winner.
If Americans lose: They still advance if Portugal and Ghana tie. Otherwise the Portugal-Ghana winner and the U.S. would each have four points and the following tiebreakers would be used: 1. Goal differential; 2. Goals scored; 3. Head-to-head. If all else fails, FIFA would draw lots.