Messi produced the first moment of quality to break the deadlock towards the end of the first half and Julian Alvarez pounced on a goalkeeping error.
Messi produced the first moment of quality to break the deadlock towards the end of the first half and Julian Alvarez pounced on a goalkeeping error to put two-time world champions Argentina in full control early in the second.
Australia went down fighting at the Ahmad Bin Ali Stadium and ensured an anxious finale after Craig Goodwin’s deflected shot reduced the deficit.
And it needed a superb last-ditch tackle from Argentina defender Lisandro Martinez to deny Australia’s Aziz Behich what would have been a stunning equaliser in the 80th minute.
A last-eight clash with the Netherlands on Friday now awaits Argentina, who recovered from a shock 2-1 defeat to Saudi Arabia in their opening match of the tournament to finish top of Group C.
Australia’s supporters were heavily outnumbered by Argentina’s fans as an expected cagey opening unfolded.
The Socceroos’ well-drilled line-up forced Argentina to take a patient, cautious approach and it was not until the 17th minute when the South Americans first threatened.
Messi picked out Alejandro Gomez on the left, but the winger blazed his shot high and wide.
There was little goalmouth action in the opening half-hour, while Australia looked comfortable in possession and forced the game’s first two corners.
But Messi injected some much-needed dynamism in the 35th minute, playing a one-two with Nicolas Otamendi on the edge of the penalty area and side-footing home into the bottom corner.
It was his 789th career goal, his 94th in 169 senior appearances for his country and his first in the World Cup knockout stages.
Argentina comfortably retained possession at the start of the second half and Messi slipped as he appeared set to score his second of the match.
Australia were left a mountain to climb after conceding an unfortunate goal in the 57th minute.
Goalkeeper Mat Ryan miscontrolled a backpass and Manchester City striker Alvarez nipped in to slot home his second goal of the tournament.
Argentina were happy to keep the ball, but after substitute Nicolas Tagliafico dragged his effort wide, Australia reduced the deficit with a deflected goal out of nowhere.
Goodwin tried his luck from outside the box and his shot struck Enzo Fernandez and flew into the bottom corner.
Australia went close to a brilliant equaliser in the 80th minute when Dundee United’s Behich weaved his way past four defenders into the area, but Manchester United centre-half Martinez’s flying tackle blocked the shot.
Argentina went close to regaining their two-goal lead through Martinez, who fired two shots off target and had a third well saved.
But Argentina’s jubilant fans held their breath in the closing moments of time added on when Australia’s teenage substitute Garang Kuol forced goalkeeper Emiliano Martinez into a crucial save.