The Iberian nation powered into a dominant lead when Pepe and Helder Postiga struck to give them a 2-0 advantage.
However, a Nicklas Bendtner header on the stroke of half-time gave the Scandinavians hope, and the Arsenal forward struck again in the second 45 to square things up.
Despite this, Portuguese substitute Silvestre Varela rifled home in the last ten minutes to give his side a crucial three points.
Paulo Bento was happy that his men won the match, but feels that the game should have been killed off earlier.
“We deserved the victory, but we suffered too much, considering what we did in the first half” Bento told reporters after the game.
“We defended well in the first half, showing some good organisation, and there was a period in which we could have scored twice more but Denmark ended up scoring with the only chance they had.
“In the second half, our plan was to make it 3-1 and not see it out at 2-1. A minute before Denmark’s equalised, we could have killed off the game.
“Then our players’ character and personality emerged. They have been working in an extraordinary way,” he concluded.
Portugal take on Netherlands in their final Group B fixture.
By Gareth McKnight