The Americans took a 2-1 lead into stoppage time after Clint Dempsey scored in the 81st minute to put them in front, but Cristiano Ronaldo's cross picked out Varela in front of goal and he turned home a header on the final play of the match to deny the U.S. a place in the knockout round.
Nani put Portugal up 1-0 in the fifth minute after a failed clearance from Geoff Cameron, but the U.S. battled back to take the lead with second-half goals from Jermaine Jones and Dempsey, only to see the three points snatched away at the death.
Jurgen Klinsmann's side will now face Germany on Thursday with the two sides tied atop the group on four points, while Portugal squares off with Ghana as both teams enter the match with one point.
More to follow...
Notable deaths of 2014 [PHOTOS]