Morocco's Atlas Lions advanced to the knockout round with a thrilling 4-2 victory over Haiti in Group C action.
The North African side came from behind twice during the first half. Achraf Hakimi and Ismael Saibari put them back on level terms with clinical finishes.
A second-half explosion sealed the deal for Morocco. Soufiane Rahimi and Gessime Yassine struck late to secure the win.
This marks consecutive World Cup knockout appearances for the Atlas Lions. They'll face Group F winners in the round of 16.
South Africa's Bafana Bafana pulled off a stunning upset against South Korea with a 1-0 victory. Thapelo Maseko scored the decisive goal in the 63rd minute.
It was a dramatic turnaround for Hugo Broos' squad. Hours earlier, elimination seemed certain as they battled to stay alive.
South Africa finished as runners-up in Group A. Their historic first-ever knockout berth sets up a showdown with Canada.
Canada dropped out of contention after losing 2-1 to Switzerland. They'll face South Africa in the round of 32.
Co-hosts Mexico dominated Group A with a 3-0 demolition of Czech Republic. All three goals came in the second half.
Brazil claimed top spot in Group C despite Morocco finishing level on points. The Seleção's superior goal difference proved decisive.
Scotland couldn't contain Brazil's attack, suffering a 3-0 defeat in the same group. Both teams finished with seven points after their respective victories.
Bosnia and Herzegovina kept their hopes alive with a 4-1 rout of Qatar. They join South Korea and Scotland as potential third-place qualifiers.
Eight third-place nations will advance from the tournament's group stage. The race remains wide open heading into the final round.
Czech Republic, Qatar, and Haiti have been eliminated. All three sides finished last in their respective groups.