Australia beat Denmark 1-0, to grab the second qualification spot in the group alongside the already-qualified France.
Australia needed that win to reach the knockout stage of the World Cup for the first time in 16 years, had Denmark equalized, Tunisia, which upset France 1-0 would advance.
The Danes, needing a victory to progress, dominated possession but were caught out on the break when Australia scored the winner on the hour mark.
Denmark lost the ball in the Australian box and Mathew Leckie finished a brilliant counterattack with a low shot past Kasper Schmeichel.
Denmark meanwhile exits Qatar 2022 in disappointing fashion, with just one point from three games, sitting bottom of the group.
Australia will now play the winners of Group C – with Poland, Argentina, and Saudi Arabia all in with a chance of topping the table – on Saturday.