Portuguese substitute Silvestre Varela scored deep into stoppage-time to secure a dramatic 2-2 draw with the United States in World Cup Group G on Sunday and keep his team's hopes alive.
Just as it looked as though the Americans had pulled off a come-from-behind victory to qualify for the second round and eliminate their opponents, Varela converted a Cristiano Ronaldo cross with a powerful flying header.
The result of another wildly entertaining World Cup match means that after two games the U.S. are in second place, level with Germany on four points. Portugal are joint bottom with Ghana on one point and face a tough task to make the next round.
"Conceding a late goal was a bummer that we have to swallow. We felt very confident after we turned it around. It ended in a tie but overall I think it was an amazing game," U.S. coach Juergen Klinsmann told a news conference.
The Americans, who made the second round in 2010, face Germany in the final game and need a point to ensure qualification.
The U.S. scored late to beat Ghana 2-1 in the first game and Clint Dempsey looked to have repeated the feat in the 81st minute, steering the ball home with his stomach to give his team the lead.
Portugal lost their first game 4-0 to Germany and coach Paulo Bento said his team had to beat the Americans.
Portugal opened the scoring in the fifth minute when U.S. defender Geoff Cameron swung a foot at a Miguel Veloso cross and succeeded only in slicing the ball across his own area right to the feet of Nani, who scored easily.
The Europeans then sat back in the heat and humidity, allowing their opponents to start dominating. The temperature in the Amazonia arena was 30 degrees Celsius (86 Fahrenheit) at kickoff with a humidity reading of 65 percent.
Portugal still looked dangerous and Nani hit the left-hand post in the 45th minute from outside the area. The ball rebounded to Eder but his looping shot was brilliantly scooped over the bar by U.S. goalkeeper Tim Howard.
As the second half progressed the Portuguese wilted and it was little surprise when U.S. midfielder Jermaine Jones cut in from the left in the 64th minute, brushed past Nani and fired in a superb right-foot curling shot from 25 meters to equalize.
"We conceded a second goal through our mistakes. I guess a draw was a fair result in the end although it left us in a very difficult situation," said Bento.
Portugal started with Ronaldo, who has been trying to shake off a knee injury. He was ineffective against the Germans and looked well below full fitness against the Americans, contributing little until the very end.
The United States were only a few minutes away from notching another surprise World Cup win over Portugal. In 2002, they beat the Europeans 3-2 in the group stage and went all the way to the quarter-finals.
Portugal go into the final game with Ghana looking short of firepower. They lost striker Hugo Almeida in the first game and his replacement Helder Postiga lasted only 15 minutes on Sunday before he came off holding his thigh.
Varela's goal was the second time he has struck late for Portugal at a major tournament. In Euro 2012, he scored an 87th-minute winner against Denmark in a first-round game.