Paulo Bento's men threw away a two goal lead, but came good in the end to stay in the hunt for a place in the last eight.
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.
However, Bendtner, on his 50th appearance for Denmark, nodded one back for his side four minutes before halftime before completing the comeback with another header nine minutes from the end.
But Silvestre Varela would have 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 qualification race for Group B into the final matchday.
It was nearly an evening to forget for Paulo Bento and his team, which had its chances to put the game to bed, most notably at the feet of Cristiano Ronaldo, who spurned two one-on-one opportunities, but Varela would spare his blushes in the end.
Denmark, which named an unchanged side from the win over Netherlands, started brightly, and forced a flurry of corners early in the game to keep the Portuguese under pressure.
Despite the 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.
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 its way back into the game. Ronaldo, as ever, was at the heart of things, 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.
The team would make the most of the momentum and doubled the 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 was 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 its 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.
Ronaldo then had a glorious chance to put Portugal 3-1 up four minutes into the second half. The Real Madrid start was put clean through on goal, but his attempted slot into the bottom corner was read well by Andersen.
Shortly after, a terrible giveaway from Simon Poulsen gifted Postiga the opportunity to pounce, but the striker was then flattened by Agger to snuff out the chance.
Denmark was 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 Ronaldo. The 27-year-old found himself one-on-one again with Andersen, but his finish was side footed 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 Portugal 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 favor.
Group B rounds off on Sunday, when Portugal faces Netherlands, followed by Denmark’s clash against Germany.
Follow GOAL.COM USA on