Daniel Jensen's stoppage time winner gave Denmark a 3-2 victory in Portugal in a World Cup Group One qualifier on Wednesday that featured four goals in the closing seven minutes.
Portugal winger Nani opened the scoring after 42 minutes when he tapped home Hugo Almeida's excellent cross from the left and the hosts dominated most of the match until the late flurry of goals.
Denmark levelled through Nicklas Bendtner's header in the 83rd before Portugal re-took the lead three minutes later with a Deco penalty.
Denmark equalised again in the 89th minute with a Christian Poulsen header after Portugal's keeper Quim failed to clear his area following a corner.
The Danes had not finished yet and grabbed all three points with Jensen's deflected shot two minutes into stoppage time.
"It's bad to lose this way, we had the game under control, but in football a team that doesn't score sometimes gets punished unfairly. We could have won but although we tried to keep Denmark under pressure, they managed to get things their way and we have to accept it," Portugal coach Carlos Queiroz told reporters.
It was the first time in 12 years that Portugal had lost a World Cup qualifying match, the last defeat coming in October 1996 in Ukraine.
Queiroz, who replaced Luiz Felipe Scolari after Euro 2008, added: "This is the result of two critical moments in which we didn't score and that gave confidence to Denmark. They believed all the way until the end. We tried to hold the game after the 2-1, now we need to recover these three points in the away game," he said.