Silvestre Varela scored in the 87th minute to give Portugal a 3-2 win over Denmark on Wednesday and revive his team's hopes of reaching the European Championship quarterfinals.
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.
The Portuguese led it late, but looked like they would have to settle for a draw after Nicklas Bendtner levelled 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.