Mr Anwar, viewed as a political prisoner by the United States and adopted as a "prisoner of conscience" by Amnesty International, has spent six years in prison.
He was released after the Federal Court upheld his appeal against a conviction and nine-year sentence for sodomy.
Mr Anwar had been tipped to become Malaysia's next prime minister before he was sacked by then-premier, Mahathir Mohamad.
Weeks later he was arrested on corruption and sodomy charges.
Dr Mahathir retired last October after 22 years in power and was succeeded by Prime Minister Abdullah Ahmad Badawi.
Mr Anwar's release has been welcomed by the United States and other foreign governments, including Australia and New Zealand.
A US State Department spokesman says Washington has, over the years, repeatedly emphasised its concerns about what it felt was the unfair jailing of Mr Anwar.
New Zealand's foreign minister, Phil Goff, says "justice has finally been done".
And human rights group, Amnesty International, says the release signals "a new beginning" for the country.
Mahathir surprised by court's decision
Former Malaysian leader, Mahathir Mohamad, has told a news conference he is "mildly surprised" by the court's decision.
Dr Mahathir says he will "not lose any sleep" over the fact that Mr Anwar has released and says the decision to jail or free his former deputy prime minister is completely up to the courts.(See... he tried to acting again)
"This is the decision of the court that he is not guilty," Dr Mahathir said.
"I always explained this to a lot of people who kept asking me to take pity, to be generous and to release Anwar.
"The fact is that I don't have the power to do that. In Malaysia, we follow the process of law." (YES! that right, since ur not there anymore... everybody seems to be clearly thinking about it, peace of mind)
Commenting on Mr Anwar's statement after his release that he did not bear malice against him, Dr Mahathir said "I must think he must be a generous person indeed."
03/09/2004 09:15:39 | ABC Radio Australia News
AG: Iâ€™m also suprised to received this news, but still grateful... exited to notice what "a new beginning" was.