Morocco became the first African team to top a World Cup group for 24 years after beating Canada 2-1 today.
First-half goals from Hakim Ziyech and Youssef En-Nesyri proved enough with Nayef Aguerd's own goal - the first of the tournament - nothing more than a consolation for a Canada side who return home without a point.
Morocco must now wait for Thursday's Group E games to see who they will face in the last 16 at Education City Stadium on Tuesday.
Walid Regragui's side needed just a point to guarantee a place in the knockout stages for only the second time, and first since 1986, and they were gifted a dream start after four minutes.
Steven Vitoria’s backpass to Milan Borjan was a little short and the goalkeeper compounded the error with a heavy touch which fell nicely for Ziyech to chip the ball into an empty net from 25 yards.
Canada looked vulnerable every time Morocco came forward and more naïve defending contributed to the second goal midway through the first half.
Achraf Hakimi’s long ball from right-back exposed center-half Kamal Miller and En-Nesyri ran onto it before firing under Borjan, who again should have done better.
Having posed no attacking threat whatsoever, Canada halved the deficit five minutes before the break. Sam Adekugbe skipped past Hakimi down the left and his low cross was diverted goalwards by the toe of Aguerd with Yassine Bounou unable to keep it out at his near post.
En-Nesyri thought he had restored Morocco’s two-goal advantage before the break, firing home after Canada had partially cleared Ziyech’s inswinging free-kick from the right but his effort was ruled out due to Aguerd blocking Borjan’s view from an offside position.
Perhaps sensing the size of their achievement, Morocco went into their shell as the second half progressed.
Alphonso Davies volleyed wide on the stretch before Canada came within inches of an equalizer after 71 minutes, 39-year-old substitute Atiba Hutchinson heading on to the underside of the bar with Alistair Johnston unable to bundle the rebound over the line.
Morocco held on, though, and a goalless draw in the other pool game between Croatia and Belgium sparked wild scenes of celebration at the final whistle.