The Malaysian opposition won a historic election victory, according to official results, reported AFP.
Earlier, Malaysia's veteran ex-leader Mahathir Mohamad, 92, said he was confident of victory as almost-complete results showed his opposition alliance with a strong lead in its fierce election battle against scandal-hit Prime Minister Najib Razak.
Votes were still being counted after the closely-fought poll and the Election Commission did not confirm Mahathir had won.
But addressing reporters in Kuala Lumpur, Mahathir -- who came out of retirement to take on his former protege Najib and the party he himself led for years -- said he believed his coalition had achieved the number of parliamentary seats needed for victory.
"There is no way they can catch up," Mahathir said, referring to the Barisan Nasional (BN) coalition which has led Malaysia since independence from Britain in 1957.
It was an incredible development in an electrifying election race, that has seen Mahathir throw in his lot with an alliance packed with parties that he crushed while in power, which includes jailed opposition icon Anwar Ibrahim -- his former nemesis.
Analysts had widely predicted that Najib's BN would retain power. They have been accused of manipulating the electoral system for decades to tilt polls in their favour, and also exercise strong control over the media.
But with 176 out of 222 parliament seats counted, Mahathir's opposition alliance, Pact of Hope had 89 seats while BN had 68, with smaller parties taking the others, the Election Commission announced. A total of 112 seats are needed to win the election.
The opposition also made strong gains in Sarawak state on Borneo island, a long-time BN stronghold.
Key BN figures, including the head of the coalition's ethnic Indian and Chinese parties, also lost their seats, according to unofficial tallies on Bernama.
Journalists had flocked to the headquarters of Najib's United Malays National Organisation (UMNO), the lynchpin in the ruling coalition -- but he failed to turn up to give a victory speech and the media were told to leave.
Mahathir had earlier accused the Election Commission of delaying the release of results "because we believe from our unofficial counting that they (BN) are left far behind and the likelihood is that they will not be forming the government".
He said the opposition had achieved the number of seats needed to win the election.
However the commission insisted it was not keeping back the results due to "bad faith" and urged people to be patient.
Huge numbers of voters earlier flocked to the polls across the country, despite Najib having called the election on a weekday in what critics said was a bid to keep turnout down.
Some voters complained they were forced to queue up outside polling stations for hours, sparking concerns they may not be able cast their ballots.
Najib had been under pressure to score an emphatic win after the government lost the popular vote for the first time at the last elections in 2013. Observers say his position as prime minister could be under threat if he does not do well.
The controversy surrounding 1MDB has dogged Najib since the story exploded in 2015. Billions of dollars were allegedly stolen from the fund, which was set up and overseen by Najib. The leader and 1MDB deny any wrongdoing.
But in rural areas, the rising cost of living which has hit poor Malays hard, has been the main concern particularly after the introduction of an unpopular sales tax in 2015.
The opposition has faced an uphill battle for victory.
Critics have accused the BN of gerrymandering with a redrawing of electoral boundaries that created constituencies more likely to back them, while activists have alleged numerous irregularities in the electoral roll.
The opposition has been targeted by authorities during the campaign, with police launching a probe into Mahathir for allegedly breaking a controversial new law against "fake news" after he claimed a plane he chartered was sabotaged.