Mahathir won the election after his coalition Pakatan Harapan secured 113 seats out of the 222 seats at the parliament's lower house, unseating the Barisna Nasional coalition, which has run the country for more than 60 years and of which Mahathir used to serve as the chairman.
Mahathir is 92 years old and is the world's oldest elected leader.
But the election, although shattering in Malaysian politics, raises several questions immediately.
Mahathir previously said he would likely remain prime minister for two to three years, before transferring power to Anwar.
Reporters and Anwar supporters were gathering on Friday outside a hospital in Kuala Lumpur where he is recovering from a shoulder surgery. America's Wall Street Journal said the return of Mahathir spells "historic shift" in the country's relationship with China and promises a "beefed up anti-corruption probe".
Mahathir has pledged to get Anwar, who is due out of jail in June, a royal pardon and eventually pass the premiership to a man who is one of the country's most charismatic and popular politicians.
Mahathir Mohamad (R) addresses the media next to Wan Azizah, Anwar Ibrahim's wife.
As Malaysia's longest-serving PM, Dr Mahathir had a striking regional and global presence.
At a press conference after being sworn in, Mahathir said the government's main focus would be on the economy.
"I pray that after this divisive period, the country will unite", he said.
"As you know, we can not revalue the ringgit too much, or else we will not be competitive, but we will try to make the ringgit as steady as possible", he added.
Various news outlets cited official sources saying there would not be a swearing in of a new prime minister on Thursday, but Mahathir was resistant to that schedule. "He has, in fact, hidden evidence of wrongdoing and that is wrong in law", Mahathir said.
Malaysian markets were closed on Friday and will reopen on Monday, but overseas investors were nervous about Najib's ouster after a decade in office. I look forward to working with Tun Mahathir and the new government to enhance our cooperation.
That skepticism is rooted in Mahathir's record as Prime Minister between 1981 and 2003, when he fought tooth and claw to hold onto power, overseeing a tenure that The Economist called "consistently authoritarian and abrasive".