View Photo Gallery: Silvestre Varela’s 87th minute goal kept Portugal in contention to advance from Group B.

On the brink of a devastating draw, Portugal was given life by Silvestre Varela and remained in contention to advance from the Group of Death.

Having seen a two-goal lead evaporate on a brace from Denmark forward Nicklas Bendtner, Varela’s right-footed strike in the 87th minute lifted the Portuguese to a 3-2 win in Group B and pulled Portugal (three points) even with Denmark (three points) and, at least temporarily, Germany, in Group B.

Germany can seal a spot in the knockout round with a win over Holland in the second game of the day.

Denmark needed a win to secure advancement from the group stage, but it was Portugal that seized control early on Wednesday, scoring twice in a 12-minute span in the first half to take the early lead.

Portugal opened the scoring in the 24th minute when Cristiano Ronaldo’s corner kick met defender Pepe outside of the six-yard box on a near-post run. The defender flicked a powerful header over his shoulder inside the near post for a 1-0 lead.

Danish forward Nicklas Bendtne, left, celebrates after scoring his second goal against Portugal. (ANNE-CHRISTINE POUJOULAT/AFP/GETTY IMAGES)

Denmark, which defeated Holland, 1-0, in its opening game, pulled one back in the 41st minute on a finish by Bendtner, the Arsenal striker who easily headed home a finish after Michael Krohn-Dehli sent a header across the front of an empty net for his teammate to put away.

The 24-year-old forward pulled his country back from the deficit with a snapped header at the far post in the 80th minute to make the score 2-2.

But Varela’s low right-footed blast provided the final margin, and Portugal, which lost 1-0 to Germany in its opener, is now in the mix to advance out of the vaunted Group B.


Injuries after fans brawl in Warsaw

Russia fined for fan behavior

Euro 2012 schedule & results