Substitute Kaoru Mitoma scored twice in the dying minutes as Japan beat Australia 2-0 on Thursday to book their place at a seventh straight World Cup and in doing so also helped Saudi Arabia qualify.
It was a crushing blow for an understrength Socceroos who now face a perilous play-off to keep alive their hopes of making Qatar.
The game in a wet Sydney looked destined for a draw before Mitoma converted from close range on 89 minutes, and then again after a mazy run in injury time to spark joyous celebrations from the visitors.
"I knew it was going to be a close match so when I was on the bench all I was thinking was, when I got on the field of play I just had to do my job and score a goal," said Mitoma, 24, who plays for Belgium's Union SG on loan from Premier League Brighton.
"I feel really happy for the players and people back in Japan, and everyone who is a Japanese fan."
Victory pushed the Blue Samurai to the top of Asian Group B qualifying on 21 points, six clear of Australia with only one more game to play.
The Saudis, on 19 points, face China in Sharjah later Thursday but are assured of their place in Qatar courtesy of Japan's win.
Australia now cannot finish higher than third, forcing a play-off against the third-placed team in Asian Group A. The winner will then meet a team from South America for the right to play in Qatar later this year.
Japan started their qualifying campaign with two losses from their first three games, but have now won six in a row.
They headed into the high-stakes clash in front of nearly 42,000 fans at Stadium Australia with a clear edge. Australia's last win over them was in 2009 and Hajime Moriyasu's men claimed a crucial 2-1 victory when the two teams met in October.
Australia were also missing a string of players due to coronavirus impacts or injury, including influential duo Aaron Mooy and Tom Rogic.
In a boost, coach Graham Arnold returned to the sidelines after seven days in self-isolation after testing positive for coronavirus last week, but he was left frustrated.
"It's obviously disappointing that we didn't get the result that we wanted," said Arnold, who has come under pressure from Australia fans.
"But at the end of the day we've got the third place spot and you've got to be positive about that. We've just got to move forward. I've always said I believe in these boys and it's one game at a time."
An energetic Japan started strongly with Liverpool star Takumi Minamino testing Socceroos keeper Mat Ryan inside the first minute.
Conditions were difficult in the rain and it took Australia 11 minutes to work their first shot, with a new-look midfield struggling to click and create chances.
While Japan controlled the tempo, Australia got the ball in the net on 25 minutes, ricocheting off Minamino from a Martin Boyle corner, but it was ruled out for an infringement.
Minamino was everywhere, clattering the post with a header and hitting the crossbar minutes later as the chances piled up for the visitors.
Australia went close twice early in the second half but they quickly tired as Japan again asserted control and constantly pressed for the winner.
Minamino again went close with 11 minutes left and it appeared headed for a draw before the late heroics from Mitoma in only his second international.
Also in Asia, South Korea and Iran have already qualified for Qatar.