Former Malaysian prime minister Mahathir Mohamad is expected to be sworn in today after his shock election victory spelled an end to the Barisan Nasional (BN) coalition's 60-year-rule.

Key points: Dr Mahathir's opposition has won 113 seats to the ruling party's 79

Dr Mahathir's opposition has won 113 seats to the ruling party's 79 A simple majority of 112 seats is required to form government

A simple majority of 112 seats is required to form government The 92-year-old was the country's authoritarian ruler for 22 years

"There is an urgency here, we need to form the Government now, today," Dr Mahathir said.

Malaysia's king will grant Dr Mohamad an audience at 9:30pm (local time), Saifuddin Abdullah, a leader from Dr Mahathir's alliance, said.

The Election Commission said official results had the opposition so far winning 113 seats out of 222. The BN, or National Front, has so far won 79.

Dr Mahathir's stunning defeat of the ruling coalition means that at the age of 92, he will become the oldest elected leader in the world.

Earlier, outgoing prime minister Najib Razak said in a televised media conference that he accepted the "choice of the people".

"I accept and my friends accept … it has been the choice of the people and the Barisan Nasional party is committed to respecting the principles of democracy," Mr Najib said.

"As one party gained a simple majority, they will make a decision on who will be appointed as prime minister according to the constitution."

Sorry, this video has expired Najib Razak concedes defeat at news conference after shock election loss.

However, Mr Najib appeared to raise doubt that the former prime minister would succeed him, saying that since no single party — but rather a coalition — had won a simple majority, and it would be up to the country's constitutional monarchy to decide who should be the next leader.

He said a representative of Malaysia's constitutional monarchy had contacted the opposition to acknowledge its victory, and that a prime minister would be sworn in within a day.

To be sworn in the King must sign Dr Mahathir's letter of appointment as prime minister, which is expected to take place during a royal ceremony in the capital Kuala Lumpur.

Earlier, a palace spokesman said Dr Mahathir would not be sworn in today, without giving reason.

Dr Mahathir said his coalition will have the support of 135 members of Malaysia's 222-seat parliament, after general election, and is entitled to form a government.

Mahathir pledges not to seek 'revenge' against opponents

Sorry, this video has expired Dr Mahathir says his government will not seek "revenge" against its opponents (Photo: AP/Vincent Thian).

Dr Mahathir emerged from retirement and joined the opposition after being angered by an epic corruption scandal involving Mr Najib.

Dr Mahathir was the country's authoritarian leader for 22 years until 2003.

Earlier, the former prime minster declared that Thursday and Friday would be public holidays, another slap for Mr Najib, who on election eve had promised public holidays if his coalition won.

Sorry, this video has expired Dr Mahathir says his face is no longer 'haram' after election victory.

Dr Mahathir was credited with modernising Malaysia during his time as leader but was also known for his heavy-handed approach, which saw opponents imprisoned and courts subjugated.

Remarkably robust for 92, he pledged the new government would not seek "revenge" against political opponents.

It would, however, seek to restore the rule of law and prosecute those who had breached it, he said.

"If anybody breaks the law, and that includes the journalists, they will be brought before the court to be tried," he said.

Opposition party supporters cheer at a rally in Kuala Lumpur. ( AP: Andy Wong )

An unexpected victory for political veteran

Few had expected Dr Mahathir to prevail against a coalition that has long relied on the support of the country's ethnic-Malay majority.

However, he joined hands with his one-time protege, the jailed politician Anwar Ibrahim, and together their alliance exploited public disenchantment over the cost of living and a multibillion-dollar scandal that has dogged Mr Najib since 2015.

Space to play or pause, M to mute, left and right arrows to seek, up and down arrows for volume. Watch Duration: 10 minutes 23 seconds 10 m Dr Mahathir Mohamad talks to The World earlier this year about his re-entry into politics.

Dr Mahathir promised to seek a royal pardon for Mr Anwar if they won the election and, once he is free, to step aside and let him become prime minister.

Several key roads in the heart of the capital, where violence between races has played out in the past, were blocked off by police as evidence grew that Mr Najib's coalition was on the back foot.

In a statement, the police appealed for calm and said that for now the situation was under control.

Mr Najib's party postponed an evening news conference and said the leader, who has ruled the country for nearly 10 years, would address the media at 9:45am (11:45am AEST).

He has not spoken publicly since the results were declared but a member of his Cabinet said they would accept the will of the people.

The opposition also swept state elections, including Johor state where the ruling National Front was founded.

The election results marked the first time the National Front had been voted out of power in the six decades since Malaysia gained independence from Britain.

Malaysia's currency weakened in offshore trading on the election result, with the ringgit one-month non-deliverable forward falling 2.4 percent to 4.07 against the dollar.

Najib's National Front loses seats in key states

Malaysian Prime Minister Najib Razak cast his vote in the coastal city of Pekan. ( AP: Aaron Favila )

BN lost seats in key states that had traditionally been its strongholds.

BN faced a far greater challenge in this election than ever before amid public anger over the cost of living and a multi-billion-dollar scandal that has dogged Mr Najib since 2015.

An election-eve opinion poll had suggested support for BN was slipping and Dr Mahathir's alliance would land the most votes in peninsular Malaysia, home to 80 per cent of the population in this South-East Asian nation.

However, under Malaysia's electoral system, the party or alliance with the majority of parliament seats wins, and going into the poll most experts had believed that was within the Prime Minister's reach.

The opposition claimed the contest would be skewed by a revision of electoral boundaries and a decision to hold the poll midweek, which it said would discourage millions from voting.

The Election Commission and Government dismissed the charges.

Malaysia's majority ethnic-Malay Muslims have tended to support BN for affirmative-action policies that give them government contracts, cheap housing and guaranteed university admissions.

Dr Mahathir's opposition alliance, which counts on urban votes and support from the minority ethnic-Chinese and Indian communities, hoped that with the former leader as its standard bearer it would draw in Malay voters traditionally loyal to BN.

Sorry, this video has expired Girish Sawlani takes a look at the major players and key battleground electorates

ABC/wires