"I feel that finally justice is coming, somebody heard... what the people are praying for", she said, adding that Malaysians wanted an end to widespread corruption that set in under the longtime ruling Barisan Nasional coalition.
Anwar's release caps a remarkable reversal of fortune made possible by the BN's unexpected electoral drubbing a week ago. He reopened a probe into the 1MDB scandal after his alliance won a stunning election victory last week, ousting Najib and ending the National Front's 60-year grip on power.
One condition for Mr Mahathir being allowed to lead the opposition coalition was that he agreed to secure a royal pardon for Mr Anwar who remained popular with his supporters.
Anwar was sentenced to five years in prison in February 2015 after the Federal Court retained a conviction for sodomy.
Anwar waved to reporters as he was whisked from a hospital Wednesday where he was recovering from a shoulder surgery.
"The pardon timing is fast, and this speaks to the recognition that his conviction was unjust", said Bridget Welsh, a political science professor at the John Cabot University in Rome.
Mahathir crossed aisles because he felt it was untenable to support Najib as premier following widespread allegations of his involvement in the 1MDB financial scandal.
Anwar, who needs to contest a by-election to become a member of Parliament, said he doesn't want any Cabinet posts yet as he plans to spend time with his family and travel overseas for speaking engagements.
To ecstatic cries of "Reformasi" (Reform) - Anwar's ralling cry - he vowed to hundreds of journalists, supporters and prison guards to support the new government's efforts to clean up the country.
The de facto leader of Parti Keadilan Rakyat (PKR) left the hospital and headed to the palace, where he was granted an audience with the King at noon, together with Dr Wan Azizah and Selangor Menteri Besar Azmin Ali. He was initially supposed to name 10 ministers but appeared to have been stalled by horse-trading over positions.
Mahathir briefly mentioned Anwar's future political role, saying he is not a member of the government but will have a role to play within the party.
Smiling and waving to supporters, Anwar, 70, was wearing a black suit with a tie.
He maintains his innocence, and says on both occasions Mahathir and Najib used trumped up charges against him to keep him out of politics. On Monday, he said he would meet party leaders again to discuss the Cabinet formation but reiterated in clear terms that as prime minister, he will make the final decision. Mr Anwar wanted to seek help from the International Monetary Fund, but Mr Mahathir favoured capital controls. "I've told Tun Mahathir, I don't need to serve in the cabinet for now", Anwar said, using an honorific for the prime minister.
However, on Tuesday the prime minister said he planned to stay on for "an initial stage, maybe lasting one or two years".More news: Centre initiates action for removal of Allahabad Bank CEO, two PNB directors