Jan Vertonghen's late goal saw 10-man Belgium beat South Korea 1-0 in their final Group H match on Thursday, despite having Steven Defour sent off just before halftime for a nasty two-footed challenge.
In the other Group H game, Algeria claimed second place with a 1-1 draw against Russia and will face Germany in Porto Alegre on Monday.
The win made it a maximum nine points for the Belgians, who will meet the United States in the last 16 in Salvador on Tuesday while South Korea head for the exit.
The European side had already qualified for the next round, having beaten Algeria and Russia in their first two games, and even a draw would have been enough to claim first place and avoid Germany in the next round.
When Defour was given a straight red for a needless, studs-up challenge on Kim Shin-wook, the game opened up for the Koreans after the break.
But although they had plenty of possession and a series of clear chances, they were caught on the break when Belgim's excellent substitute Divock Origi struck from distance.
Keeper Kim Seung-gyu palmed the ball into the path of the onrushing Vertonghen, who put it away with ease in the 78th minute.
An even first period saw Dries Mertens miss a golden chance for Belgium eight metres from goal when he shot well over while, at the other end, Ki Sung-yueng had a rasping long-range shot well saved by keeper Thibaut Courtois.
Belgium coach Marc Wilmots made seven changes from the team that beat Russia, with captain Vincent Kompany and fellow defender Thomas Vermaelen dropping out due to slight injuries, while playmaker Eden Hazard started on the bench.
The Belgians are considered "dark horses" by many pundits to go all the way in Brazil after their star-studded squad went through World Cup qualifying unbeaten.
But they looked far from fluent in their group games, coming from behind late to edge Algeria 2-1, beating Russia through Origi's 88th-minute goal and only just edging past the Koreans.
Away at Curitiba, Islam Slimani headed an ecstatic Algeria into the last 16 of the World Cup for the first time with a 1-1 draw against Russia that dumped Fabio Capello's team out of the tournament.
On a momentous night for the North Africans, who were the last team through to the knockout rounds with Belgium already qualified as Group H leaders, Algeria recovered from an early Alexander Kokorin goal to advance.
The point, in a tense match at the Baixada Arena with everything still at stake and 2018 hosts Russia needing a win to go through at Algeria's expense, was all the 'Desert Foxes' needed to make history.
The draw was all they deserved but it came after an early setback, with Kokorin meeting a beautifully-flighted Dmitry Kombarov cross to nod in a perfectly-executed header in the sixth minute.
Algeria, whose Bosnian-born coach Vahid Halilhodzic had called the match the most important in the country's soccer history, rarely threatened in the first half and looked a shadow of the side who thumped four goals past the Koreans.
Slimani had an effort tipped over the bar by goalkeeper Igor Akinfeev in the 30th minute but the linesman had already flagged for offside and Algeria's other tame attempts had Halilhodzic gesticulating furiously from the touchline.
It all changed in the second half, though, with Algeria looking far sharper before the goal and then resisting the pressure.
Slimani seized his chance in the 60th minute with a powerful header at the near post from a Yacine Brahimi free kick that Akinfeev failed to reach.
Capello had made just one change to the side who lost 1-0 to Belgium, handing a first start of the tournament to veteran striker Alexander Kerzhakov in place of Maxim Kanunnikov but the goals failed to flow.