Portugal will head to Copenhagen needing just a point from their final qualifier against Denmark on Tuesday to reach Euro 2012.
They reached that position of strength after two goals from Nani set them on the way to victory in a high-scoring clash with Iceland.
Although a Denmark win would take the hosts through to the finals next week, Portugal have perhaps a slight advantage, having beaten the Danes at home earlier in the campaign.
So although both sides will start on the same points, a draw would leave Portugal secure in first place on the basis of their head-to-head record.
If Nani can find top gear again, Portugal should not have to worry about such matters.
The Manchester United winger outshone his international team-mate Cristiano Ronaldo, another former Old Trafford favourite, by firing Portugal two goals clear in the early stages of the Group H tussle.
They reached half-time with a 3-0 advantage before letting Iceland back into the match, only to restore the three-goal margin. Iceland managed a late consolation from the penalty spot.
Helder Postiga, Joao Moutinho and Eliseu were Portugal's other scorers, with Iceland's goals at the Estadio do Dragao in Porto coming from Aron Gunnarsson, Hallgrimur Jonasson and Birkir Bjarnason.
Portugal went ahead after 13 minutes when Eliseu crossed for Nani to head into the bottom right corner.
Ronaldo and Carlos Martins peppered the Iceland goal with shots before Nani netted again in the 22nd minute, this time with a right-footed strike from close range.
Ronaldo, the prolific Real Madrid forward, was looking for a goal to take him fourth in the list of Portugal's all-time leading scorers, but it just would not come.
He saw a shot punched away by goalkeeper Stefan Magnusson and another cleared the bar.
At the other end, Bjarnason shot wide, but Portugal were dominant. Martins drew a save from Magnusson before Postiga hit the home side's third goal in the 44th minute after a cross by Bruno Alves from the right flank.
The match looked all over, and Nani and Ronaldo both had shots very early on in the second half, but in the 48th minute Iceland found a goal.
A foul by Alves on Gylfi Sigurdsson presented the visitors with a free-kick which led to Hallgrimur Jonasson scoring.
Ronaldo had four goal attempts inside 10 minutes, the first three of which almost brought goals before he sent a long-range strike off target.
But Iceland were not finished and in the 67th minute it was 3-2 when Sigurdsson's corner found its way to Jonasson and he finished from six yards.
Eliseu and Nani, seeking his hat-trick, both fired off target, before Portugal snatched their fourth goal in the 81st minute, Eliseu setting up Moutinho for a close-range finish.
Eliseu drilled in the fifth goal, and the late penalty hardly mattered, Bjarnason with the formalities after being fouled by Jorge Rolando.