Prime Minister Benjamin Netanyahu has won the Israeli national election, securing a record fifth term in office despite running neck-and-neck with his challenger Benny Gantz, the country's three main television channels said on Wednesday.
With 97 per cent of the votes counted, neither of the candidates' parties had captured a ruling majority, but Netanyahu was clearly in a strong position to form a coalition government with other right-wing factions that have backed him.
The closely contested race was widely seen in Israel as a referendum on Netanyahu's character and record in the face of corruption allegations. He faces possible indictment in three graft cases, and has denied wrongdoing in all of them.
The veteran right-wing leader's Likud party and Gantz's new centrist Blue and White party both won 35 seats, according to the Knesset website and the Israeli TV channels. That would mean a five-seat gain for Likud.
"It is a night of colossal victory," the 69-year-old Netanyahu told cheering supporters in a late-night speech at Likud headquarters, while cautioning that a "long night and possibly day" lay ahead awaiting official results.
Fireworks flared behind him as his wife Sara applauded and kissed him.
"He's a magician," the crowd chanted.
Final results were expected by Friday, though the provisional results showed 65 of the Knesset's 120 seats would go to the right-wing bloc of parties led by Netanyahu, against a total of 55 seats for centre-left factions.
If he wins, Netanyahu, 69, will be on track to be the longest-serving prime minister in Israel's 71-year history. Netanyahu said he had already begun talks with prospective coalition allies.
In power since 2009, and having led the country for a total 13 years including his first term in the 1990s, Netanyahu has been fighting for his political survival.
He faces possible indictment in three graft cases. He has denied any wrongdoing.
Rival Gantz, a popular 59-year-old former general, had also claimed victory earlier, citing preliminary exit polls published soon after voting ended on Tuesday that showed his party had won more seats than Likud.
"We are the victors," said Gantz, a former military chief fighting his first election. "We want to thank Benjamin Netanyahu for his service to the nation."
Despite both men claiming victory on Tuesday night, a clearer picture emerged by Wednesday morning as the results began streaming in, painting Netanyahu as the winner.
Netanyahu highlights Trump lies
During the campaign, the rival parties accused each other of corruption, fostering bigotry and being soft on security.
Netanyahu highlighted his close relationship with US President Donald Trump, who delighted Israelis and angered Palestinians by recognising Jerusalem as Israel's capital in 2017 and moving the American Embassy to the holy city last May.
Two weeks before the election, Trump signed a proclamation, with Netanyahu at his side at the White House, recognising Israeli sovereignty over the occupied Golan Heights captured from Syria in the 1967 Middle East war.
In a rare turn during the race towards the Israeli-Palestinian conflict, Netanyahu further alarmed Palestinians by pledged to annex Jewish settlements in the occupied West Bank if re-elected. Palestinians seek a state there and in the Gaza Strip, with East Jerusalem as its capital.
Netanyahu's pre-election promise was widely seen as an attempt to draw right-wing votes rather than a change of policy. But with Trumps moves on Jerusalem and The Golan, the prime minister may feel emboldened to advocate for annexation.
Commenting on the election, Palestinian chief negotiator Saeb Erekat said: "Israelis have voted to preserve the status quo. They have said no to peace and yes to the occupation".
The last round of US-brokered peace talks between Israel and the Palestinians collapsed in 2014.
Trump is expected to release his administration's long-awaited Middle East peace plan after the election. If it includes Israeli concessions to the Palestinians, Netanyahus probable far-right coalition allies will likely object.
A close result in the election would put smaller parties in a powerful position, turning marginal political figures into kingmakers.
Once the votes are tallied, President Reuven Rivlin will ask parties that have won parliamentary seats who they support for prime minister. He will then pick a party leader to try to form a coalition, giving the candidate 28 days to do so, with a two-week extension if needed.