Sweden sprang a surprise with a 3-0 thumping of Mexico, breaking their opponents' resistance after a scoreless first half and guaranteeing that both teams advance to the World Cup last 16 at the expense of defending champions Germany.
Sweden finished top of Group F on goal difference, with both teams on six points ahead of South Korea and Germany on three apiece, after the champions went down 2-0 to the South Koreans in a shock result in Kazan.
It marked a remarkable swing in Swedish fortunes after the crushing disappointment of losing to a stoppage-time goal from Germany's Toni Kroos four days ago.
"I am so incredibly proud, moved almost, by the thought of how we performed in the match. They were so disciplined, so loyal in everything they did," coach Janne Andersson said.
For Mexico, the lacklustre performance in Yekaterinburg marked a reality check.
"I have to say that we qualified because we beat Germany and Korea, but nevertheless I am very hurt," coach Juan Carlos Osorio told reporters. "I was not too happy with the way we defended at all."
After pressing hard for most of the first half and wasting numerous chances, Sweden finally found the net when left back Ludwig Augustinsson charged up the field in the 50th minute and angled home a left-footed volley.
Twelve minutes later, captain Andreas Granqvist kept his concentration in the face of deafening boos and whistles from the Mexican fans to blast a penalty into the top left corner after Hector Moreno had brought down Marcus Berg.
Mexico's misery was complete when the ball trickled in off the leg of Edson Alvarez for a tame own goal on 74 minutes.
"This is something I dreamed of. The insane thing is I really had this feeling that I would score at the World Cup," Augustinsson told reporters.
Granqvist, who also scored from the spot against South Korea, said: "What a performance - it could have been 5-0 or 6-0."
The Mexicans were a shadow of the team that pundits were tipping as potential champions after their sparkling start to the tournament.
Sweden, by contrast, look like a side capable of going further - a turnaround for a team that struggled to score in their pre-World Cup games.
Needing only a draw to advance, Mexico started tentatively but somehow reached the break on level terms after surviving a Swedish aerial bombardment and a VAR review when Javier Hernandez appeared to handle the ball in his penalty area.
The game was packed with incident from the opening whistle, with Mexican Jesus Gallardo booked within seconds for misjudging an aerial challenge on Ola Toivonen.
The Swedes were guilty of wasteful finishing in the opening 45 minutes, with Emil Forsberg blazing several shots over the bar.
The Mexicans' best efforts came through Carlos Vela, with three shots in the first half, and in the later stages through a Hernandez header and a cross from the striker that flew straight across the face of the Swedish goal.
Mexico's desperate late efforts proved unnecessary, as South Korea gave them a helping hand to the last 16 with their stunning win over Germany.
But without an improvement on this performance they risk falling once again in the last 16, the same stage where they have been knocked out in the last six World Cups.
They will now face the winners of Group E in Samara on July 2, while Sweden will play the runners-up the following day in St Petersburg. The Swedes will be without midfielder Sebastian Larsson, who picked up his second booking of the tournament.