Morocco advanced to the last 16 at the World Cup for just the second time after clinging on for a 2-1 win over Canada on Thursday.
The Moroccans' only other trip past the group stage came in 1986.
Hakim Ziyech scored for Morocco in the fourth minute after a bad error by Canada goalkeeper Milan Borjan left the winger to shoot the ball into an empty goal. Youssef En-Nesyri added a second in the 23rd.
It looked then like Morocco would overrun the Canadians.
But Nayef Aguerd's own-goal just before halftime made it 2-1 and lifted Canada enough for them to put pressure on Morocco in search of an equalizing goal for most of the second half.
Canada came agonizingly close when a header from captain Atiba Hutchinson, who came on as a second-half substitute, bounced off the crossbar and onto the goal-line.
A draw would also have been enough for Morocco to advance.
Canada, which will co-host the next World Cup in 2026 with the United States and Mexico, ultimately lost all three of its games in Qatar, matching its three defeats at its only other World Cup appearance in 1986.