Mathew Leckie claimed a fine second-half winner as Australia masterminded a World Cup shock by progressing to the knockout stages with a 1-0 victory which eliminated Denmark.
The Socceroos and the Danes were both in danger of crashing out of the tournament due to Tunisia taking the lead against reigning champions France in the other Group D fixture. But Leckie had other ideas and delivered the knockout blow for the Danes with a superb solo effort in the 60th minute to send Australia into the last 16 for the first time since 2006.
The Melbourne City forward ran almost half the length of the pitch and twisted and turned Joakim Maehle before calmly finishing beyond Kasper Schmeichel.
Denmark offered little in response, albeit they were denied a penalty by an offside flag when Algerian referee Mustapha Ghorbal pointed to the spot following Harry Souttar's adjudged foul on Kasper Dolberg.
Graham Arnold's men, who finished the group behind France on goal difference, will face one of Poland, Argentina or Saudi Arabia in the second round on Saturday.
Australia head coach Arnold told BBC Two: "I'm so proud of the effort by the boys. There was a short turnaround but their effort was incredible.
"A lot of belief and hard work. These boys come in with a great mindset. We've been working on this for the last four/four and a half years about the belief, the energy and the focus. I could see in their eyes, they were ready tonight."
With the Socceroos starting the day in second spot courtesy of their win over Tunisia, the onus to attack was on Denmark.
The Danes were initially positive and dominated possession against a team 28 places below them in the FIFA world rankings, only to be frustrated in a forgettable opening period.
Australia goalkeeper Mathew Ryan tipped over from Mathias Jensen and unconventionally turned away a dangerous cross from marauding left-back Maehle, while Christian Eriksen dragged an effort wide.
Socceroos coach Arnold had spoken pre-match about "putting the game on the map a bit more" back home, as well as his desire to make the Australian public smile.
While his compact side were content to sit in and keep things tight, Middlesbrough's Riley McGree tested Schmeichel during a rare foray forward to show they could cause problems on the counter attack.
The pattern of play persisted into the second period before a goal in the other Group D game left both sides in grave danger.
News of Tunisia forward Wahbi Khazri opening the scoring against France appeared to have filtered through to the Al Janoub Stadium just before Leckie latched on to McGree's through ball to race clear and finish with aplomb.
Denmark needed at least two goals to avoid leaving Qatar early but, with their lack of cutting edge, even an equaliser seemed unlikely.
Australia endured a major scare 19 minutes from time when substitute Dolberg tumbled in the box before the penalty decision was swiftly overturned.
The spirited Socceroos, led impressively by Scotland-born centre-back Souttar, defended doggedly and deservedly survived six minutes of added time to upset the Euro 2020 semi-finalists and march on.
Read more
Qatar World Cup 2022
Three Lions advance as Dragons sent home
Lineker's on-air gaffe after England win
Player ratings as England reach last 16
Bale future under microscope after loss