Denmark stunned Portugal with a 2-1 win that saw them leapfrog the visitors and secure automatic qualification for Euro 2012 as winners of group H.
Michael Krohn-Dehli and Nicklas Bendtner netted for the 1992 European champions, while Cristiano Ronaldo pulled one back for Portugal.
The Portuguese - finalists in 2004 - will have to come through a two-legged playoff next month if they are to join the Danes at next summer's finals.
Paulo Bento's Portugal had won their last five games and needed only a point here to win the group, but they put in a poor performance, and were punished by a hungrier-looking home side.
It was no surprise when Brondby midfielder Krohn-Dehli opened the scoring on 13 minutes with a crossed shot that was deflected into the net by Portugal defender Rolando.
Michael Silberbauer and Bendtner had chances to double the lead while Nani fired well over the crossbar with an effort that summed up Portugal's first-half display.
Whatever Bento said to his players at the interval failed to have the desired effect, and Denmark extended their advantage just after the hour mark when Sunderland's Bendtner netted after being set up by Dennis Rommedahl.
Only several vital interventions from goalkeeper Rui Patricio prevented Portugal from suffering a humiliating loss, and while Ronaldo did reduce the deficit with a stunning free-kick in stoppage time, it came too late to save his side.