The murder charge was dropped in a case that drew suspicions of being a political assassination.
As the court announced its decision, Siti Aisyah, 26, turned to her Vietnamese co-defendant, Doan Thi Huong, 30, in the dock and the two women, who had been facing the death penalty together, embraced in tears.
They had been accused of poisoning Kim Jong Nam, the half-brother of North Korean leader, Kim Jong Un, with liquid VX, a banned chemical weapon, at Kuala Lumpur airport in February 2017.
Following the dramatic decision to release Aisyah, a defence lawyer asked for an adjournment in the case against Huong in order to submit a request that charges be dropped against her too.
Defence lawyers have maintained that the women were pawns in an assassination orchestrated by North Korean agents.
Interpol had issued a red notice for four North Koreans, who were identified as suspects by Malaysian police and had left the country hours after the murder.
During the trial, the court was shown CCTV footage of two women allegedly assaulting Kim Jong Nam while he prepared to check in for a flight.
Aisyah, who had worked as a masseuse at a hotel in the Malaysian capital, and Huong, who described herself as an actress, had maintained that they believed they had been hired to participate in a reality TV prank show.
Once the court released her, Aisyah, wearing a black traditional Malay dress and headscarf, was rushed to the Indonesian embassy, where she spoke briefly with journalists.
“I feel so happy. I did not expect that today I would be released,’’ Aisyah said, adding that she was healthy and had been treated well in prison.
Prosecutors told the court that they had been instructed to withdraw the charge against Aisyah, but no reason was given.
While the court discharged Aisyah from the case, it rejected her lawyer’s request for a full acquittal, as it said that the trial had already established a prima facie case and she could be recalled if fresh evidence emerged.
The defence had disputed whether the CCTV footage was clear enough to identify the Indonesian woman as an assailant or establish what she had done to the victim.
Gooi Soon Seng, Siti Aisyah’s lawyer, said his client was “a scapegoat”.
“I still believe that North Korea had something to do with it,’’ Gooi said.
Kim Jong Nam had lived in exile in Macau for several years before the killing, having fled his homeland after his half-brother became North Korea’s leader in 2011 following their father’s death.
Some South Korean lawmakers said the North Korean regime had ordered the assassination of Kim Jong Nam, who had been critical of his family’s dynastic rule.
Pyongyang has denied the accusation.
Although the two women were being tried together, the cases against them were separate and the court had asked the Indonesian woman to present her defence first.
Aisyah’s trial was suspended in December as her lawyers argued with prosecutors over access to statements made by seven witnesses.
Prosecutor Muhammad Ahmad said the decision to withdraw the charge against her was made based on “several representations” without elaborating.