Australia's impressive pre-World Cup results continued with a 2-1 victory over Hungary that was marked by two blundering own-goals towards the end of a combative encounter.
After the Socceroos were pinned back for long periods of the game, second-half substitute Daniel Arzani scored with a bobbling shot on 74 minutes, but his efforts were undone by defender Trent Sainsbury.
The Australia captain headed through his own net two minutes from time in comedy fashion, only to have his blushes spared four minutes later when opposite number Tamas Kadar nutmegged his own goalkeeper in injury time.
Bert van Marwijk's side had beaten the Czech Republic 4-0 in their previous warm-up match, but struggled to create chances against a Hungary side that had lost two of their last three home games.
The Socceroos failed to land a single shot on target in the first half and had goalkeeper Mat Ryan to thank for a number of important saves that prevented the hosts from taking the lead.
While Van Marwijk might have been pleased to see his defence survive a stern test from the Hungarian attack, he will not have appreciated the combative nature of Georges Leekens' side, who missed out on the World Cup after finishing third in their qualifying group.
FULL TIME | 2-1 . Next stop: Russia June 9, 2018
Australia found themselves in an unwanted physical battle early on and endured pressure from Hungary, who probed down the left through Gergo Lovrencsics.
Slowly the Socceroos began to assert themselves and Robbie Kruse crashed a shot onto the crossbar from Aaron Mooy's cross after 16 minutes only to be flagged offside, and he turned Mathew Leckie's low ball over three minutes later.
Ryan did well to save at the feet of Adam Szalai and then pulled off a brilliant last-ditch block to prevent the same player from opening the scoring on the half-hour mark, making himself big and saving with his legs after a Mark Milligan error let the striker through on goal.
There was nothing Ryan could do about Laszlo Kleinheisler's ferocious 25-yard shot that dipped over the goalkeeper before hitting the top of the crossbar on its way into the stands.
Roland Sallai flashed a shot over the top from distance early in the second half as Hungary kept the pressure on, but Australia's defence became wise to their opponents' favoured lines of attack.
With the visitors' defence proving harder to penetrate, Lovrencsics lashed a shot well over from 20 yards before substitute Jackson Irvine landed Australia's first shot on target at the other end, forcing Peter Gulacsi into a high save with his rising effort from close range.
Arzani picked the ball up on the left and cut inside before rattling a low, bobbling shot that Denes Dibusz misjudged and it squirmed under his body and into the bottom right corner of the net.
Just as Arzani's goal looked to have settled it, Sainsbury stooped to head Attila Fiola's cross back towards his own goal having failed to spot the position of substitute goalkeeper Brad Jones, who could not prevent the ball from crossing the line.
Much to Sainsbury's relief, Australia piled forward and Irvine's cross into the six-yard box was poked through Hungary substitute Dibusz's legs at the death.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.