It is Australia's first time in the knockout stage since 2006, the only other time they advanced out of the group stage.
Leckie took a pass just around the center circle and moved in and around a Danish defender, eventually lacing a left-footed shot that beat goalkeeper Kasper Schmeichel diving to his left.
Australia finished with six points in Group D.
The World Cup proved to be a major disappointment for Denmark after reaching the semifinals in the 2020 European Championship. They slogged through a 0-0 draw in their opening match with Tunisia and then recovered in a 2-1 loss against France.
The Danes attacked from the start against Australia but could never break through with the Socceroos.
This story has been published from a wire agency feed without modifications to the text. Only the headline has been changed.