Just as it looked as though the Americans had secured a come-from-behind victory to qualify for the second round, Varela scored with a flying header from a Cristiano Ronaldo cross.
Clint Dempsey had given the United States the lead in the 81st minute, steering the ball home with his stomach from close range.
Portugal had taken an early lead and then sat back in the heat and humidity, allowing the Americans to start dominating.
It was little surprise when midfielder Jermaine Jones cut in from the left in the 64th minute and fired in a superb right- foot curling shot from 25 metres to equalise.
The result means the US are in second place, level with Germany on four points, and Portugal are third with one and face a tough task to make the next round.
Portugal took the lead 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 Portuguese played slowly, appearing to try to conserve energy in the tough conditions. The temperature in the Amazonia arena was 30degC at kickoff with a humidity reading of 65 percent.
Portugal nevertheless looked capable of scoring again 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 US goalkeeper Tim Howard.
Portugal started with Ronaldo, who has been trying to shake off a knee injury. He only shone fitfully against the Americans, leaving the best until last.