(CNN) -

This time it was the United States that gave up the dramatic goal.

Portugal's Silvestre Varela scored on a strong headed goal deep, deep in stoppage time to give Portugal a desperate 2-2 draw with the United States in a key Group G World Cup match at Manaus, Brazil.

The goal, in the 95th minute, came off a cross from Cristiano Ronaldo, who showed no signs of a knee injury that was the subject of much media attention in the buildup to the contest.

Second-half strikes by U.S. midfielder Jermaine Jones and striker Clint Dempsey had given the United States a 2-1 lead until Portugal rescued its World Cup chances.

"You're disappointed not to get three points, but at the same time you have to take the positives from the game," Dempsey said. "We're happy with four points, and there's everything to play for in the last game."

The United States plays co-group leader Germany on Thursday while Ghana and Portugal square off.

The Americans will win the group with a victory, but could also advance to the Round of 16 with a draw and a tie in the other match, which will be played at the same time.

But if Ghana or Portugal wins and the other match also has a winner, tiebreakers -- the first being goal differential -- will determine the second-place team in the group.

"We gave our maximum," Ronaldo said, according to a CNN translation. "We're obviously frustrated and sad with what happened."

The Portugal star wasn't counting on getting the arduous results his team needs Thursday to advance.

"There aren't miracles in football. We knew it was a difficult group. Either we could qualify or we'd get knocked out," he said. "Honestly, I never thought we were going to be the world champion. Anything can happen, now we have to be humble."

Time to rally

The American goals made up for an early U.S. miscue that allowed Portugal to take a 1-0 lead when Nani scored after a U.S clearance attempt went awry.

U.S. defender Geoff Cameron tried to knock away a cross, but the ball went to a wide-open Nani, who waited for U.S. goalkeeper Tim Howard to go down, then slammed home a shot from 6 yards in the fifth minute.

"You never want to get scored on, but it was good for us," said U.S. midfielder Kyle Beckerman, who thought the Americans picked up their play immediately after the goal.

Jones scored a sweet goal after Portugal cleared a U.S. corner. The German-born player took a couple of touches that unleashed a wicked bending shot that left Portugal goalkeeper Beto standing helplessly still in the 64th minute.

Dempsey scored in the 81st minute when midfielder Graham Zusi sent a ball toward goal that the U.S. star redirected into the net.

Portugal, the fourth-ranked team in the world and one of the pre-tournament favorites in Group G, outshot the Americans 20 to 15.

But Howard had four saves, including one that kept the U.S. from going down two goals. After a Nani shot ricocheted off the post, Howard swept away a rebound from Eder while reaching over his left shoulder.

"I don't think Portugal broke us down. I think we in a way let ourselves down," said Howard, who was named man of the match. "So that's kind of a good sign because had we gotten torn apart, it would have been a lot tougher."

Lineup changes

The Portuguese team was missing defender Pepe through a red card suspension and striker Hugo Almeida and defender Fabio Coentrao, who were injured.

Dempsey was playing with a broken nose that he said made it hard to breathe in the Americans' 2-1 dramatic win over Ghana on a late goal by substitute John Brooks. After the match, he said he made it through Sunday's contest without problems.

The United States was missing striker Jozy Altidore, who has a strained left hamstring. Dempsey, normally a midfielder, moved to the top of the U.S. formation in Altidore's place while Zusi slid into the starting lineup.

The game was played in the heat and humidity of the Amazon rainforest. The heat index was 93 degrees at kickoff, and the weather seemed to have an effect on the pace of the game as the match moved into the second 45 minutes. The referee even allowed a short water break in the first half, a first in a World Cup match.