Mathew Leckie scored a dramatic 86th-minute winner as Australia piled the pressure on Saudi Arabia in the race to qualify for the World Cup by beating Thailand 2-1 in its final fixture.

A tense match in Melbourne saw Australia hit the post three times and have two efforts cleared off the line but the team appeared to have done enough when Tomi Juric eventually struck 21 minutes from the end, his third goal in as many qualifiers.

But Pokkhao Anan netted a fine finish with eight minutes remaining as Thailand hit back, only for Leckie to settle a contest that saw the host rack up an astonishing 45 shots.

Ange Postecoglou's men are now reliant on Group B winners Japan avoiding defeat in Saudi Arabia later on Tuesday in order to join Vahid Halilhodzic's side in Russia, having failed to better the Saudis' goal difference.

If the Saudis claim victory, Australia will have to make do with a third-place finish which would take the team into a play-off system, facing off against a fellow AFC team to earn a shot against CONCACAF's fourth-place nation for a spot at the tournament.

Australia created a great early chance when Leckie raced down the right before cutting back to Aaron Mooy, who saw his left-footed strike hit the base of the post.

Tom Rogic had a long-range effort parried away by Sinthaweechai Hathairattanakool, before the host hit the woodwork for a second time when Tim Cahill curled a magnificent effort from the edge of the area off the inside of the post.

A Mooy drive forced another save from the Thailand goalkeeper as Australia remained on top, while Cahill blazed over from a good close-range chance on the turn.

When a Mooy corner was kept alive by the Socceroos and Hathairattanakool failed to punch clear, Mark Milligan's strike was cleared off line as two defenders bore down on him and there were still further chances for Australia before half-time. 

After the visiting keeper was adjudged to have carried the ball out of his box, Juric made a hash of the resulting free-kick, blazing over, before the striker had another golden chance moments later having been sent through on goal by Leckie, only for defender Adison Promrak to make a heroic block.

The visiting team caused a major scare early in the second half and had a strong penalty claim turned down when Trent Sainsbury challenged Teerasil Dangda as the Thailand captain raced through on goal.

The lively Rogic had two efforts saved as Australia desperately searched for the opener, before he became the third player to hit the post after another Mooy corner caused chaos.

Australia finally scored when Mooy's in-swinging cross from the left was headed in by Juric after he nipped in front of Hathairattanakool.

Rogic, who was responsible for 13 of his side's attempts, forced a fine save from Hathairattanakool, while Juric had another effort cleared off the line by Tristan Do as the hosts looked to boost their goal difference in comparison to the Saudis.

But Thailand stunned the home crowd when a tidy passing move ended with Perapat Notechaiya cutting back from the left and Anan firing a shot from 12 yards in off the underside of the bar.

Australia was not to be denied, though, Mooy's corner punched clear into the path of Leckie to fire in a deflected effort from eight yards, as all eyes turned to the match in Jeddah.