Mahathir Mohamad is to become the world's oldest elected leader at 92, after a shock victory in Malaysia's bitterly fought election. He will be sworn in at 21:30 local time (13:30 GMT), according to the state news agency, Bernama.
The former PM came out of retirement and defected to the opposition to take on his one-time protégé Najib Razak.
His historic win has ousted the Barisan Nasional (BN) coalition, which has been in power since independence in 1957.
Jubilant Mahathir supporters filled the streets as the victory became clear.
Mr Najib has said he will "accept the verdict of the people", but correspondents say a smooth transition to power is not a given after such a major political upheaval.
No single party within the coalition won a majority, so technically it fell to Malaysia's king to decide who formed a government.
How have people reacted?
"Yes, yes, I am still alive," Mr Mahathir told a news conference in the early hours of Thursday. He said his coalition would not seek revenge but would "restore the rule of law".
He also announced - to cheers among his supporters - that there would be a two-day public holiday, adding: "But there will be no holidays for the winners."
The official results showed the opposition Pakatan Harapan - the Alliance of Hope - secured 113 of the 222 seats being contested, including some which have only ever been held by the government. BN took 79 seats.
Crowds of elated Mahathir supporters celebrated his victory in Kuala Lumpur
Rising living costs and long-running allegations of corruption weighed heavily on many voters and saw them peel away from Mr Najib and his once unshakeable coalition.
"I feel that with this change we probably can see something better in the future," Suva Selvan, a 48-year-old doctor, told AFP.
"Our hope for the future is a better government, fair, free and united."