Prosecutors told the court on Monday that they had been instructed to withdraw the charge against Siti Aisyah.
As the court gave its decision to release her, 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, embraced tearfully.
Both the women denied committing murder, saying they believed they were taking part in a prank and were deceived by North Korean agents.
Aisyah was quickly ushered out of the court building in an embassy auto.
As she left court, the Indonesian woman told reporters: "I feel happy". Huong was to have begun giving her defense in Monday's court session, after months of delay.
The murder charge against an Indonesian suspect in the killing of North Korean Kim Jong-nam has been withdrawn.
While the court discharged Siti Aisyah from the case, it rejected her lawyer's request for her to be fully acquitted, as it said that the trial had already established a prima facie case and she could be recalled if fresh evidence emerges.
Huong's lawyer Hisyam Teh Poh Teik said Huong felt Aisyah's discharge was unfair to her as the judge previous year had found sufficient evidence to continue the murder trial against them.
"Miss Aisyah was led to believe that her actions were for a reality show hence she had no real understanding of the real reason she had to perform as she was asked to and has no intention of killing Kim Jong Nam", Mr Yasonna wrote.
Huong's Lawyer, Hisyam Teh Poh Teik, said they will seek to postpone the trial.
Indonesia's ambassador to Malaysia, who was in court with Aisyah, thanked the judge and the Malaysian government, but declined to answer questions about what is next for her.
Their lawyers have previously said they were pawns in a political assassination with clear links to the North Korean Embassy in Kuala Lumpur, and that the prosecution failed to show the women had any intention to kill.
Jong-nam was the eldest son in the current generation of North Korea's ruling family. He had been living overseas for years but could have been seen as a threat to Kim Jong Un's rule.