The Americans had looked to be safely into the last 16 after second-half goals by Jermaine Jones and Clint Dempsey saw them come back from 1-0 down -- a goal by Nani -- to lead.
However, with only seconds remaining one sublime cross from a pretty anonymous Ronaldo was met by Varela and it soared past Tim Howard to give Portugal a lifeline as a further defeat after the 4-0 hammering by Germany in the opening game would have seen them out.
The United States -- who reached the last 16 in 2010 only to lose to Ghana -- are on four points along with Germany, who they play in their final group game, and who their coach Jurgen Klinsmann led at the 2006 finals.
Ghana and Portugal both have one point and play also on Thursday.
The Portuguese got just the start they needed to settle their nerves as a terrible defensive error by Stoke City's Geoff Cameron -- the ball flying off his boot to Nani saw the Manchester United winger wait for Howard to commit himself before rifling the ball into the net.
It had been preempted by an outrageous piece of skill by Ronaldo down the left side, completely bewitching three American players as they tried to corral him out on the touchline, only for a series of step overs and a backheel to see him squirm through the three of them.
The Portuguese's cursed run of injuries continued as veteran striker Helder Postiga -- who himself started only because Hugo Almeida had gone off injured early on in the opening game against Germany -- lasted just 16 minutes before he had to go off and be replaced by Eder.
Klinsmann's men were running the game and a fine move ended with Michael Bradley, son of former United States coach Bob, unleash a fine effort from outside the box that cleared the bar.
Conditions even in the evening were so draining that five minutes from the break, when Jermaine Jones received some treatment, the referee allowed both sides to rehydrate with a drinks break.
Howard, who was earning his 102nd cap, kept his side in the game on the stroke of half-time as he somehow managed to stick a hand out as he dived the wrong way to tip a pointblank shot by Eder over the bar.
There was an even finer block the other end 10 minutes into the second-half as Bradley's goalbound effort from only 10 yards out saw defender Ricardo Costa spread himself deflect the ball off his knee for a corner, earning a well deserved kiss on the head from goalkeeper Beto.
The Americans, though, deservedly levelled in the 64th minute as Jones produced a pearler of a right-footed shot from outside the area, leaving Beto rooted to the spot.
Ronaldo and the Portuguese appeared shellshocked and it was the Americans who grabbed a second as Bradley's shot rebounded to Graham Zusi off a defender and his cross was put into the net by Dempsey's stomach for his fourth goal at a World Cup finals.
That looked to be that until, like Lionel Messi with his late goal against Iran on Saturday, Ronaldo summoned up one piece of class with his pinpoint cross, which was enough to break American hearts.