The king appoints the premier, and rival candidates had this week been seeking to show they commanded majority support from MPs As well as ending the premiership of Mahathir, at 94 the world's oldest leader, it means there will be little hope of his designated successor Anwar Ibrahim becoming prime minister.
Muhyiddin's coalition is dominated by the multi-ethnic country's Muslim majority, and includes the United Malays National Organisation (UMNO), the scandal-plagued party of disgraced ex-leader Najib Razak.
UMNO was the lynchpin of a long-ruling coalition toppled from power at historic elections in 2018 amid allegations Najib and his cronies looted state fund 1MDB.
Muhyiddin, a former Mahathir ally, had joined forces with UMNO in a bid to win power. His coalition also includes a hardline Muslim party that is pushing for Islamic laws.
The current crisis began when Mahathir and Anwar's ruling "Pact of Hope" alliance, which stormed to a historic victory two years ago against Najib's government, collapsed a week ago.
A group of ruling coalition lawmakers had joined forces with opposition parties in a bid to form a new government without Anwar and stop him becoming premier.
After that effort failed, Mahathir and Anwar launched rival bids to win power, reviving a rivalry that has shaped politics
for more than two decades in the Southeast Asian nation.
But as Muhyiddin's bid quickly gained support and it became clear that he could get into power with UMNO, Mahathir and Anwar did a volte-face and joined forces again on Saturday.
The remaining parties from the "Pact of Hope" alliance threw their support behind Mahathir to become premier, and there had been hopes he could stop Muhyiddin.
The "Pact of Hope", a ragtag band of opposition groups that included a party dominated by the country's ethnic Chinese minority, Anwar's People's Justice Party and Mahathir's Malay-dominated outfit, was uneasy from the start.
Mahathir had pledged to eventually hand the premiership to Anwar, but many were sceptical he wanted to give power to his old rival, and rival factions were seeking to push Anwar out.
Muhyiddin, 72, was a member of UMNO for many decades and held a string of senior posts. He was deputy prime minister in Najib's government, but Najib sacked him after he voiced criticism of the 1MDB scandal.