With more than 97 percent of votes counted, Israeli Prime Minister Benjamin Netanyahu conservative party looked likely to muster enough support to hand him a parliamentary majority despite a close contest against his main centrist challenger.
Netanyahu's Likud party looked likely to muster enough support to control 65 of the Knesset's 120 seats and be named to head the next coalition government — a record fifth term as premier.
The close and often vitriolic contest 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.
Despite that, Netanyahu gained four seats compared to his outgoing coalition government, according to a spreadsheet published by the Central Elections Committee of parties that won enough votes to enter the next parliament.
Related: Politics in Israel move to the right
"It is a night of colossal victory," the 69-year-old Netanyahu told cheering supporters in a late-night speech at Likud headquarters after Tuesday's vote.
"He's a magician," the crowd chanted as fireworks flared and Netanyahu kissed his wife Sara.
Tel Aviv Stock Exchange main indexes opened up 0.5 percent on Wednesday, showing confidence in a prime minister who has overseen a humming economy and restrained security challenges.
His challenger, the new Blue and White party of ex-general Benny Gantz, claimed a more modest victory after winning a 35-seat tie with Likud. Unless he reverses on campaign pledges to shun Netanyahu, and joins him in a future broad coalition, Gantz looked destined to lead a center-left parliamentary opposition.
"The skies may look overcast ... but they cannot conceal the sun of hope that we have brought to the Israeli people and society," Gantz, 59, wrote in an open letter to supporters.
Should Netanyahu retain the helm, he will become the longest-serving Israeli prime minister in July, overtaking the country's founding father, David Ben-Gurion. That could be scuppered if criminal charges are filed and force his removal.
An indictment decision would follow a review hearing where Netanyahu can be expected to argue he should be spared, in the national interest. Some political analysts predict he may try to pass a law granting himself immunity, as a sitting leader, from trial.
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 recognizing Jerusalem as Israel's capital in 2017 and moving the US 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, recognizing Israeli sovereignty over the occupied Golan Heights captured from Syria in the 1967 Middle East war.
In a rare turn during the race toward the Israeli-Palestinian conflict, Netanyahu further alarmed Palestinians by pledging 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 Trump's 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, Netanyahu's probable far-right coalition allies will likely object.
Once the vote tally is final, 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.
By Jeffrey Heller and Maayan Lubell/Reuters
Additional reporting by Rami Ayyub in Rosh Ha'ayin, Ron Bousso and Rawan Sheikh Ahmad in Haifa, Rahaf Ruby, Stephen Farrell, Dan Williams and Maayan Lubell in Jerusalem; Editing by Angus MacSwan.