Maria Elvira Pinto Exposto was arrested at Kuala Lumpur airport in December 2014 carrying 1.1kg (2.4 pounds) of crystal methamphetamine.
The court accepted her argument that she had been unaware of the presence of the drugs in her luggage.
Her lawyer said she had fallen for an online romance scam and had been tricked into carrying the drugs.
Death by hanging is mandatory for drug trafficking in Malaysia.
Anyone found in possession of at least 50g (1.75 ounces) of crystal meth is considered a trafficker.
Ms Exposto, who has three grandchildren, wept and hugged her son after being acquitted.
"I'm happy now that I'm free," she said as she left court in Shah Alam near Kuala Lumpur.
The 54-year-old had been travelling from Shanghai to Melbourne when she was arrested.
Her defence lawyers said she had travelled to China to see someone she met online called Captain Daniel Smith, who claimed he was a US serviceman. She failed to meet him and instead ended up being asked by a stranger to carry a backpack to Melbourne.
"I agreed with the defence's argument that the accused had no knowledge of the drugs that were in her bag," the judge said, calling her naïve.
"I believe that at that time her feelings of love towards 'Captain Daniel Smith' overcame everything, including her own husband, her family and her future."
Hundreds of people have been sentenced to death for drug crimes in Malaysia in recent years but few executions have been carried out.
Last year lawmakers voted through a change in the law to ensure capital punishment would no longer be mandatory in drug trafficking cases.
The legislation must still be passed by the upper house so would not have applied in Ms Exposto's case. Prosecutors are appealing against her verdict.
Three Australians have been put to death for drug offences in Malaysia; Kevin Barlow and Brian Chambers in 1986 and Michael McAuliffe in 1993.