Varela scored from short range three minutes after coming on as a substitute in the 84th minute, helping the Portuguese bounce back from a 1-0 loss to Germany in their opening game.[break]
The Portuguese left it late, however, and looked like they would have to settle for a draw after Nicklas Bendtner leveled the score with his second goal in the 80th.
Pepe gave Portugal the lead with a header in the 24th and Helder Postiga added another in the 37th. But Bendtner scored in the 41st when he headed into an open goal after Michael Krohn-Dehli headed across the goal from the back post.
Cristiano Ronaldo had another miserable game, squandering two clear chances in front of Denmark goalkeeper Stephan Andersen.
The Danes entered the match after beating the Netherlands 1-0.
Claire Danes digs into mystic mystery in 'The Essex Serpent'