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 equalize.
The result means the U.S. 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.