"In elections, there are winners and losers, and we are the winners," he said. "We won, and we will keep on winning."
What is certain is that Gantz, a former military chief of staff who entered politics late last year, has put up a formidable challenge, even if he fails to secure the position of prime minister.
"He started his move three months ago, and it looks like he could have won as many seats as the Likud Party that's existed for more than 40 years," said Meir Rubin, executive director of the right-wing Kohelet Policy Forum. "It's an incredible achievement."
Netanyahu, a dominant force in Israeli politics for a quarter of a century and Israeli leader for a total of 13 years, had painted the election as a referendum on his leadership.
He has been battling to win a new political mandate even as possible corruption charges loom. Israel's attorney-general has recommended indicting the Prime Minister in three corruption cases, including on bribery, corruption and breach-of-trust charges, though Netanyahu has a chance to present a defence first.
In the coming days, Israeli President Reuven Rivlin will nominate the leader of the party with the majority of support to try to form a government. Rivlin will make this choice after consulting parties that have won seats in the Knesset.
A potential complication could arise if Gantz wins a majority but does not have enough support from other parties to form a governing coalition.
"Then the President faces a conundrum," said Reuven Hazan, a political science professor at Hebrew University. The President can delay for up to seven days to give Gantz a chance to build support, he said. "But the name of the game is forming a majority."
If the election had been a straight referendum on Netanyahu, Gantz might have been in a better position to become prime minister, according to partial results and exit polls. But in Israel's fragmented political system, about 40 party slates contested the election. To become prime minister, a party leader must cobble together a majority of at least 61 seats in the Knesset - so it is not necessarily the head of the party with the most seats that becomes prime minister.
The fate of Israel's veteran leader could hinge ultimately on whether smaller right-wing parties, which would join a Netanyahu coalition, reach the 3.25 per cent vote threshold required to enter the Knesset, the equivalent of winning around four seats. That includes the New Right party of right-wing Education Minister Naftali Bennett.
At the same time, the vote total of the Arab Ram-Balad Party is also hovering around the threshold level, and if that party succeeds in winning seats, it could stymie Netanyahu's chance of forming a coalition
Moshe Feiglin, a libertarian pro-pot candidate who has says he's open to joining either main party, was also hovering around the threshold.
"The small parties will be the story of this election," said Rubin. "They will change everything."
Israeli television stations broadcast dramatic countdowns to their exit polls, which the three main channels all released as soon as the polls closed. While Channel 12 had initially called a much closer race, with the Knesset evenly split and Netanyahu four seats behind Gantz, that channel later adjusted its projections to include voters polled in the last hours of voting and predicted that Netanyahu would lead by one seat.
"I want to tell you something personal; I am thrilled the people of Israel have shown their belief in me for the fifth time," Netanyahu said.
Gantz also expressed confidence that he could form a coalition, but not all were convinced. "It was a nice victory speech," quipped Channel 12 anchor Yonit Levy. "But we don't know if it was a victory."
Gantz has tried to rally people around a message of unity, but some saw a vote for him simply as a vote against Netanayhu.
"I don't really care who comes in his place," said Michael Livny, a doctor voting near Jerusalem. "I just don't want a crook as my leader anymore."
In the lead-up to the election, Netanyahu urged his supporters not to be complacent, saying that right-wing governance was in peril and that the election was not in the bag. He sought to pull votes away from smaller right-wing parties by telling their supporters that there might not be a right-wing government at all if they did not vote for his Likud Party.
In a final bid to garner right-wing support, he promised to apply Israeli sovereignty to Jewish settlements in the West Bank, which are considered illegal by much of the international community. He had also stoked fears that Gantz would team up with the Arab parties to form a coalition.
Despite the legal challenges he faces and the controversies that have surrounded him, Netanyahu has a die-hard base that will vote for him unquestioningly. Michaela Ben Lulu, a lifetime Likud supporter called Netanyahu a magician and said she admired his diplomacy, especially his relationship with US President Donald Trump.
"He loves this nation and the nation loves him," she said of Netanyahu. "I don't care about the corruption claims or indictment. He doesn't need money. He's straight and trustworthy."
Two hours before the polls closed, the turnout was running behind the levels of the last election, according to the elections committee.
Police said they were investigating "irregularities" in polling stations in Arab-majority areas in the northern Israel, after reports that as many as 1200 Likud volunteers were found with hidden cameras. But Arab party representatives said that they had more pressing things on their minds.
There were indications that turnout among Arab Israelis, who account for around 20 per cent of the population, may have dived amid dissatisfaction over a split in the main Arab slate. Moves by Netanyahu's Government that were perceived as anti-Arab, such as the adoption of the controversial Nation State law last year, bolstered calls for an Arab boycott of the vote.
The low Arab turnout, which may have declined by as much as 12 per cent, could have a "dramatic impact" on the results, said Yohanan Plesner, president of the Israel Democracy Institute. If one of the Arab parties drops out of the Knesset, that could significantly boost Netanyahu's coalition-building chances, he said.