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.
With 97% of the votes counted, neither of the candidates' parties had captured a ruling majority, but Mr 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 Mr 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 Mr 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," Mr 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.
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 Mr Netanyahu, against a total of 55 seats for centre-left factions.
If he wins, Mr Netanyahu, 69, will be on track to be the longest-serving prime minister in Israel's 71-year history.
Mr Netanyahu said he had already begun talks with prospective coalition allies.
Mr Gantz had also claimed victory earlier, citing preliminary exit polls published soon after voting ended yesterday that showed his party had won more seats than Likud.
"We are the victors," said Mr 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 last night, a clearer picture emerged by this morning as the results began streaming in, painting Mr Netanyahu as the winner.
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.