Portugal's Helder Postiga (23) celebrates after scoring his side's second goal
Substitute Silvestre Varela's late thunderbolt boosted Portugal's hopes of reaching the Euro 2012 last-eight.
A brace from Denmark striker Nicklas Bendtner looked set to leave Paulo Bento's men facing an uphill task to advance from Group B, reports the BBC.
Pepe's thumping near-post header put Portugal ahead, before Helder Postiga smashed in a close-range volley.
Denmark, knowing victory would put them on the brink of a quarter-final place, fought back with two Bendtner headers.