The Seleccao blew a two-goal lead against Morten Olsen's side but Silvestre Varela popped up with a late winner to keep them in contention for a place in the quarter-finalPortugal coach Paulo Bento insisted that his side were good value for their 3-2 win over Euro 2012 Group B rivals Denmark on Wednesday but admitted that they had very nearly paid the price for not killing the game off earlier.
The Seleccao were 2-0 up after just 36 minutes thanks to goals from Pepe and Helder Postiga, but they were pegged back by Nicklas Bendtner, who notched just before the break and then again with just 10 minutes remaining.
However, Silvestre Varela netted a late winner for Portugal to keep their hopes of qualifying for the knockout stages alive.
"We deserved the victory, but we suffered too much, considering what we did [in the first half]," Bento told SIC after the game in Lviv.
"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 [through Cristiano Ronaldo].
"Then our players' character and personality emerged. They have been working in an extraordinary way."
Portugal, who were beaten by Germany in their tournament opener, will now travel to Kharkiv to take on the Netherlands in the decisive last round of group matches.