Media playback is not supported on this device
The substitute headed in a Cristiano Ronaldo cross after it appeared Clint Dempsey had sent the Americans through.
Portugal took an early lead through Nani, but Jermaine Jones' superb strike levelled the scores just after an hour.
A draw between Germany and USA will see both through, while Portugal must beat Ghana to have a chance of progressing.
Portugal are relying on a Germany win and must also achieve a six-goal swing if they are to pip the USA to second place and reach the last 16.
Realistically, they had needed to win in the Amazonian rainforest after a 4-0 thrashing by Germany in their opening game, but their performance was at least a marked improvement on that showing in Salvador.
Media playback is not supported on this device
For the USA - who had opened with a late win over Ghana - this was a performance characterised by attacking verve and defensive slackness, the latter allowing the European side to race into a fifth-minute lead, and also to hit back with the final whistle seconds away.
Their first defensive lapse came when Geoff Cameron sliced an attempted clearance across the face of his goal to Nani, the Manchester United winger finishing emphatically past Everton keeper Tim Howard.
The early goal stung the Americans into action, and they chased the game to create decent chances from which Clint Dempsey and Michael Bradley failed to test Portugal keeper Beto.
But while Portugal looked vulnerable to the USA's rapid counter-attacks, they remained a threat going forward themselves and went close to doubling their lead just before the break when Nani struck the post from outside the area, and Eder's follow-up was brilliantly pushed over by Howard.
"Michael Bradley, one of our most experienced players, loses it which gives Cristiano Ronaldo the chance.
"Now USA are in a dangerous position, and it could come down to goal difference against Ghana - who look a better side than Portugal on this evidence."
Ronaldo's participation had been in some doubt following a bout of tendonitis in his left knee, and while the World Player of the Year looked good when supplying his team mates, his finishing was wayward.
Ten minutes into the second half, Bradley should have equalised, but the midfielder's side-footed shot from close range was superbly cleared off the line by Ricardo Costa.
The miss was soon forgotten, though, when Jones side-stepped Nani before bending in a brilliant shot from outside the box beyond the static Beto.
With less than 10 minutes to go, Dempsey stooped to guide the ball in off his midriff from close range for what looked to be the winner, until the defence switched off again in the 94th minute and Varela dived to meet Ronaldo's cross and claim what might still turn out to be a crucial point.
USA coach Jurgen Klinsmann: "When you concede in the last second it is unfortunate, but it was an amazing game from us - I can't ask for any more. Now we have to get a result against Germany and that is what we are going to do.
"We will take even more confidence into the next game. It will be another final but that is what the World Cup is about.
"Germany played yesterday and so have more time to recover. We played in the Amazon and they haven't had to travel much. Everything has been made easy for the favourites, whereas we have to struggle to go through, but that is what we will do."
Portugal manager Paulo Bento: "It's clearly not a good result for us. The 2-2 doesn't put us out of the World Cup mathematically, but it does leave us in a very difficult situation.
"Not just because of what we'll need to do against Ghana, but also because we'll need a favourable result from the Germany-United States game.
"We were unlucky late in the first half, but it was a great effort to level the match (in second-half stoppage time).
"Now all we can do is to give everything in our very last game and try and make the most of the very little chance that we have left."
Silvestre Varela's equaliser deep into injury time kept Portugal in the World Cup as their Group G clash with the USA ended in a dramatic draw in Manaus.