Cristiano Ronaldo set up Varela for a late equalizer on a hot and humid night in the jungle Sunday to give Portugal a 2-2 draw with the United States and hope for a spot in the second round of the World Cup.
Ronaldo, who has been playing despite a left knee injury, sent in a cross in the fifth minute of stoppage time and Varela scored with a diving header in the last seconds of the match.
Nani had scored first for Portugal, shooting past a sprawling Tim Howard in the fifth minute, but the Americans responded in the second half as Portugal seemed to wilt in the stifling heat.
Jermaine Jones made it 1-1 with a curling shot in the 64th minute after a cross from Graham Zusi made its way through the Portugal defence.
Clint Dempsey, playing with a broken nose, then put the Americans ahead in the 81st. The United States captain used his stomach to direct the ball into the net from a cross by Zusi.
The last-second draw denied the Americans a spot in the second round, but it kept Portugal alive in the tournament.
"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. "It's going down to the last game and hopefully we get the job done."
The United States now has four points in Group G, the same as Germany. Both Portugal and Ghana have one point. The Americans will face Germany on Thursday in Recife, while Portugal takes on Ghana at the same time in Brasilia.
"Now we have to go out and beat Germany, that's what we have to do," U.S. coach Jurgen Klinsmann said. "We have to play Germany, we have one less day to recover, we played in the Amazon, they played on a place with less travel. We have to do it the tough way."
It was all Portugal for much of the first half, with Ronaldo in the starting lineup but getting less involved as the match progressed. The Americans, however, started to get more and more chances and even had a shot from Michael Bradley cleared off the line by Ricardo Costa in the 55th.
The heat in the Amazon rainforest, however, seemed to slow the Portuguese as the match wore on.
In the 39th minute, referee Nestor Pitana on Argentina called for a cooling break, the first such decision to be taken at the World Cup.
At the start of the match, FIFA listed the temperature at 30 degrees C (86 degrees F) with 66 per cent humidity. FIFA uses the "Wet Bulb Globe Temperature" to determine when official cooling breaks should be added, and says the WGBT must be above 32 degrees C (90 degrees F) for them to be considered.
The breaks are supposed to occur in the 30th and 75th minutes.
Dempsey's goal was his fourth at a World Cup and second at this year's tournament. Jones scored his third goal for the United States national team and first in almost two years.
United States: Tim Howard; Fabian Johnson, Geoff Cameron, Matt Besler, DaMarcus Beasley; Kyle Beckerman, Jermaine Jones, Alejandro Bedoya (DeAndre Yedlin, 72), Michael Bradley, Graham Zusi (Omar Gonzalez, 90); Clint Dempsey (Chris Wondolowski, 87).
Portugal: Beto; Andre Almeida (William Carvalho, 46), Ricardo Costa, Bruno Alves, Joao Pereira; Miguel Veloso, Joao Moutinho, Raul Meireles (Varela, 69th), Nani, Cristiano Ronaldo; Helder Postiga (Eder, 16th).