Highlights: Morocco exit the World Cup after loss to Portugal
Cristiano Ronaldo's fourth goal of the tournament was enough to give Portugal a 1-0 win over Morocco in their World Cup Group B match in Moscow.
Portugal can look forward to a game against Iran, knowing they have one foot in the last 16, while the North Africans have only pride to play for against Spain.
Having waited 20 years for a fifth appearance at a World Cup, fans of the Lions of the Atlas have travelled here in large and loud number. The pre-match singing contest was a walkover.
Unfortunately, their heroes started this game as they finished the last against Iran by conceding a header from a corner in the fourth minute.
Real Madrid star Ronaldo produced a brave header as he flung himself in front of Morocco striker Khalid Boutaib's raised foot to power the ball past Monir El Kajoui.
After his hat-trick against Spain, this was Ronaldo's 85th goal in international football and he is now second on the all-time list behind Iranian Ali Daei, who has scored a remarkable 109 goals.
And that, in many ways, was the story of the first half. The European champions did not do much but what they did create always involved Ronaldo.
He nearly scored another with a neat turn and shot five minutes later, set Goncalo Guedes up for a chance that El Kajoui saved well just before the break and generally strutted around like he owned the Luzhniki Stadium.
He was also twice booted in the air, earning Karim El Ahmadi and captain Mehdi Benatia yellow cards.
Morocco could not complain about either of those but they were getting increasingly annoyed with American referee Mark Geiger and VAR for decisions they felt they were not getting, most notably a penalty shout when Nordin Amrabat was hauled down by Raphael Guerreiro on 25 minutes.
The second half started in the same fashion, as Morocco's fans drove their players on, knowing their tournament would be over in 45 minutes.
And they so nearly gained their reward in the 57th minute, when Patricio, who has just signed for Wolves, produced the save of the tournament so far to deny a Benatia header.
Three minutes later, the captain would have another chance but this time he blazed a shot over the bar from 15 yards out. He had two more decent chances, too, but failed to hit the target.
Morocco were undeniably the better team, particularly in the second half, but they could not find that last pass, or when they did, they could not get the right player on the end of it.
It would be an exaggeration to say Portugal were grimly hanging on at the end or that they are a one-man team. But it is fair to say that their talisman was the difference again in a game they did not deserve to win.