Israeli PM Benjamin Netanyahu looks all but certain to stay in office for a record fifth term after his biggest election challenger, Benny Gantz, admitted defeat on Wednesday.
With almost all votes counted, both men's parties are neck and neck.
But a coalition between Mr Netanyahu's Likud and smaller right-wing and religious parties could form a 65 seat majority in the 120-seat Knesset.
US President Donald Trump has already offered his congratulations.
Mr Netanyahu tweeted that the president had called him from Air Force One - the US presidential aircraft - on Wednesday.
If he forms a new governing coalition, Mr Netanyahu would be on course to become Israel's longest-serving prime minister, overtaking the country's founding father David Ben-Gurion.
However, he could be indicted in three corruption cases in the coming months.
Mr Gantz's deputy in the centrist party has vowed to make the government's life difficult after the close result.
"We didn't win in this round. We will make Likud's life hell in the opposition," Yair Lapid said.
In a late-night speech to supporters on Tuesday, Mr Netanyahu claimed a "colossal victory".
"It will be a right-wing government, but I will be prime minister for all," Mr Netanyahu told cheering supporters at Likud's headquarters.
"I'm very touched that the people of Israel gave me their vote of confidence for the fifth time, and an even bigger vote of confidence than previous elections.
"I intend to be the prime minister of all citizens of Israel. Right, left, Jews, non-Jews. All of Israel's citizens."
The remaining ballots, cast at military bases, will be counted over the coming days, Reuters reports.
President Reuven Rivlin will then chose a leader best placed to assemble a majority.
No party has ever won a sole majority in Israel's parliament and it has always had coalition governments.
Exit polls had earlier predicted a tight race with no clear winner, and after initial results Mr Gantz also claimed victory.
Early exit polls were positive for Mr Gantz
There were roars of celebration at the election night party for Benny Gantz as the first exit poll was released. His supporters believed Israel was on the brink of a new centre-ground government.
But as the votes were counted overnight, Benjamin Netanyahu's success became clearer. The incumbent PM's Likud party appears most likely to be able to form another coalition government with the help of right-wing nationalist and religious parties.
He said history had given the people of Israel another chance as his supporters, using his nickname, chanted: "Bibi, the King of Israel."
With left-wing and Arab-Israeli parties suffering heavy losses, his win appears decisive, despite the most serious challenge yet to his decade in office.
Why did Mr Netanyahu prevail?
In the end, the prime minister was able to rally his right-wing base to deliver the votes he needed.
During the campaign, he pitched himself as the sole guarantor of Israel's security.
He warned that Mr Gantz would set up a "leftist" government with the support of Israeli Arab parties that would allow the creation of a Palestinian state, which he said would pose a mortal threat to Israel.
Mr Netanyahu also promoted his foreign policy credentials, travelling abroad to meet US President Donald Trump and Russian President Vladimir Putin, and hosting Brazilian President Jair Bolsonaro.
In a final election-day push, he warned Likud's supporters that if they stayed at home and did not vote their opponents would win.
Likud was meanwhile criticised for sending 1,200 observers equipped with hidden body cameras to polling stations in Arab communities.
The Arab alliance, Hadash-Taal, said it was an "illegal" action that sought to intimidate Arabs. Likud said it wanted to ensure only "valid votes" were cast.
What does it mean for the peace process?
Recent weeks have seen tensions flare between Israel and Palestinian militants in the Gaza Strip, and US President Donald Trump is expected to publish his plan which aims to solve Israel's long-standing conflict with the Palestinians soon.
However, ways to revive the moribund peace process were not a main subject of electoral debate.
Many Israelis appear to see little hope in the longstanding international formula for peace - the "two-state solution". The phrase denotes a final settlement that would see Israel living peacefully alongside an independent state of Palestine, defined within pre-1967 ceasefire lines in the occupied West Bank, East Jerusalem and Gaza.
In the final days of the election campaign, Mr Netanyahu made a significant announcement suggesting a new government led by him would annex Jewish settlements in the West Bank. The settlements are considered illegal under international law, although Israel disputes this.
Israel's once-dominant Labour party, which sealed a breakthrough peace deal with the Palestinians in the 1990s, had its worst-ever performance in this year's elections - winning just six seats.
The secretary general of the Palestine Liberation Organisation (PLO), Saeb Erekat, tweeted a downbeat view of the prospects for peace.
What allegations is Mr Netanyahu facing?
At the end of February, Attorney General Avichai Mandelblit informed Mr Netanyahu that he intended to indict him on charges of bribery, fraud and breach of trust in connection with three cases, pending a final hearing.
Now the election is over, evidence in those cases will be turned over to the lawyers of those involved.
The prime minister is accused of accepting gifts from wealthy businessmen, and of dispensing favours to garner positive press coverage. Mr Netanyahu has denied any wrongdoing and said he is a victim of a political "witch-hunt".
A date for the final hearing, at which the prime minister and his lawyers would be able to argue against the allegations, has not yet been set. Mr Mandelblit has said the Supreme Court will determine whether Mr Netanyahu has to resign if he is charged.
There have been reports that Mr Netanyahu will attempt to persuade potential coalition partners to pass legislation that would grant prime ministers immunity from prosecution while in office.
The Jerusalem Post reports that Likud and four other allied parties, who together will control 61 seats in the Knesset, have made it clear that they will not require Mr Netanyahu to resign if he is charged.
What comes next?
President Reuven Rivlin will consult with political parties. Afterwards, a candidate will be chosen who is deemed able to form a government that controls at least 61 seats in the Knesset. The process could take several weeks.
Mr Netanyahu has promised to speedily put together a coalition with his "natural partners". Some Israeli analysts have predicted that this could produce a government that will accelerate the nationalist and conservative policies pursued by the outgoing administration.
The ultra-Orthodox parties Shas and United Torah Judaism, which each won eight seats, have said they would join a coalition led by Mr Netanyahu. The Union of Right-Wing Parties, which won five seats, and the centre-right Kulanu party, which came away with four seats, have also said they would back him.
Avigdor Lieberman, the leader of the right-wing Yisrael Beiteinu party, has yet to announce his decision. The former defence minister has said he will either sit in opposition or support Mr Netanyahu, but not back Mr Gantz.
Have your say
More World Headlines
- Ethiopia 'coup ringleader killed'
- Zimbabwe bans use of foreign currencies
- Aksum: The holy city where mosques are banned
- Iran: New US sanctions target Supreme Leader Khamenei
- Sudan crisis: Internet restored - but only for lawyer
- Woman wakes up alone on dark, parked plane
- Jihadists kill 7 Chadian soldiers, local guard in ambush
- Man ordered to compensate ex-wife for 27 years of house chores
- US 'launched cyber-attack on Iran weapons systems'
- Ethiopia army chief shot dead in 'coup bid' attacks
- Ugandan activist to be prosecuted over president's mother
- Harry and Meghan split from William and Kate joint charity
- Gunmen kill dozens in 'terrorist' Mali attack
- Biden refuses to apologise for working with racist senators
- Nigeria condemns attack on its embassy in London