Sweden have won Group F! They will face the runners-up of Group E (Brazil, Switzerland or Serbia).
Mexico have clung on to second spot.
But the big story is that defending champions Germany are out of the World Cup.
And they finish bottom on goal difference after losing 2-0 to South Korea. Wow. Who predicted that?Copyright: BBC Sport
Former Arsenal defender on BBC Two
It was a very difficult match-up for Mexico in styles. From the first minute Sweden's intent was so clear, the set pieces, how physical and organised they were. They thoroughly deserved to win the game 3-0.
Mexico are through despite are disappointing performance. Sweden pull it out of the bag when it mattered.Copyright: BBC
Former Everton midfielder on BBC Two
I don't think anyone saw Sweden winning by three goals. I can't tell you how much I am enjoying this World Cup, the drama of it, the unpredictability. The change in momentum and scorelines is fantastic. Probably the best World Cup I can remember.
Full time. It's confirmed. Germany have lost to South Korea.
Mexico and Sweden progress to the knockout stages.Copyright: Reuters
The Mexican and Swedish fans are celebrating hand in hand in the crowd here. They know what is about to be confirmed with Germany's imminent defeat.
They're still playing in Kazan. It's not official yet.
Former England & Man Utd defender in Russia
What a game of football. Sweden have been unbelievable. Better than Mexico in every facet. Mexico survive by skin of their teeth, relied on South Korea for a favour. They are going to have some party in Ekaterinburg.
SOUTH KOREA HAVE A SECOND. THAT IS IT. GERMANY ARE GOING OUT.
The Mexico players are all waiting together in the middle of the pitch.
Sweden are celebrating.
Full time here.
Sweden are definitely through.
Now we wait for the Germany result.
The Germans need two goals in the final minute of stoppage time to knock out Mexico.
GOAL GIVEN TO SOUTH KOREA!!
GERMANY ARE GOING OUT!
Now the Mexican fans know it. Incredible celebrations here. The party is starting.Copyright: Getty Images
They're going to VAR for that South Korea goal against Germany....
Just a minute left here.
SOUTH KOREA HAVE THE BALL IN THE NET!!
BUT IT'S OFFSIDE.
The Mexicans are cheering in the stands here. They don't know it has been disallowed.Copyright: Getty Images
Alex: Huge respect to Sweden for picking themselves up from the heartbreak of Saturday night and producing this today.
We're into four minutes of added time. Both of these teams are going through as it stands.
Only a Germany goal will change that.
They're playing six minutes of added time in Kazan.
Shot from Mexico goes way over. They want a corner but it won't matter either way. They don't have the time left to improve their goal difference enough I don't think.
But that will only be needed if Germany score. It's still 0-0 there.
More checking of the phones by the Mexicans.
HUUUGE miss by Mats Hummels for Germany over in Kazan. Mexico are still alive as it stands. Just.
Sweden's Mikael Lustig is the latest man to go in the book here.Copyright: Getty Images