Lviv: Paulo Bento`s men threw away a comfortable lead following a battling fightback by the Danes, but came good in the end to stay in the hunt for a place in the quarter-finals
Pepe headed the Seleccao into the lead from a corner, before Helder Postiga put them further in control with a confident finish from close range.
But, Bendtner, on his 50th appearance for Denmark nodded one back for his side four minutes before half-time before completing the comeback with another header nine minutes from the end.
The action was not over, however, as Silvestre Varela had the last laugh, grabbing the winner with a sublime effort in the 87th minute to put Portugal level on three points with the Danes, and take the race for a quarter-final spot into the final matchday.
Denmark started the brighter of the two sides, and forced a flurry of corners early in the game to keep the Portuguese under pressure.
Despite their lack of initial enterprise, Bento’s men threatened first, Miguel Veloso whipping in a devilish ball from a short corner that was capably punched away by Stephan Andersen.
And there was bad news for the Danes just past the quarter-hour mark when Niki Zimling was forced off through injury, with Jakob Poulsen coming on as his replacement.
Portugal improved shortly after, and slowly began to play their way back into the game. Cristiano Ronaldo, as ever, was at the heart of everything, dragging a one-two with Veloso wide before hammering a free-kick into orbit.
The Iberian nation would strike first after 24 minutes. Joao Moutinho took charge of a corner, and Pepe stole a march at the near post to plant a header past Andersen into the roof of the net.
And they made the most of their momentum, and doubled their advantage in the 37th minute. Nani found himself with time and space on the right flank, and squared low to Postiga, who ghosted ahead of Simon Kjaer to lash into the top corner.
Denmark were quick to react though, and halved the deficit within four minutes. Kvist Jorgensen clipped towards Michael Krohn-Dehli at the far post, who nodded back across the six yard box for Bendtner to head into an empty net.
Portugal almost replicated their second goal on the stroke of the interval, but this time Kjaer was able to slide ahead of Postiga to hack away another dangerous cross from Nani.
Cristiano Ronaldo then had a glorious chance to put Portugal 3-1 up four minutes into the second half when clean through on goal, but his attempted slot into the bottom corner was read well by Andersen.
The chances keep on coming for the Seleccao with Postiga gifted the opportunity to pounce after terrible giveaway from Simon Poulsen, but the striker was then flattened by Agger to snuff out the chance.
Denmark were then forced into another change on the hour mark, as Dennis Rommedahl hobbled off in obvious discomfort, with Tobias Mikkelsen coming on in his stead.
Despite the setback, the Danes were inching their way back into the match. Kvist caused a few hearts to flutter with a thunderous drive from the edge of the area that whistled inches away from the top corner.
Bendtner was next to try his luck after plucking a pass out of the air at the corner of the box, but his finish did not match his control, and was scuffed wide of the mark.
The Danes should have been dead and buried on 78 minutes, but were spared thanks to another awful miss from Cristiano Ronaldo. The 27-year-old found himself one-on-one again with Andersen, but his side-footed finish was comfortably wide of the mark.
Within three minutes, Denmark would make him pay. Lars Jakobsen lifted a cross towards the far post over the head of Pepe, where Bendtner was waiting to head home via the woodwork.
However, just when it looked like they had thrown the game away, Varela rescued all three points with a well-taken half-volley from a Fabio Coentrao cross to settle the game in Portugal’s favour.