JERUSALEM — Prime Minister Benjamin Netanyahu’s main rival conceded defeat Wednesday, promising to wage a robust battle from the opposition after the ruling Likud party and its nationalist allies won a solid majority in parliamentary elections.

Netanyahu appeared poised for a historic fifth term as prime minister with nearly all the ballots counted from Tuesday’s vote. Official results were expected Thursday. With 97.4% of the vote counted, Netanyahu’s Likud and the rival Blue and White were deadlocked with a projected 35 seats apiece in the 120-seat parliament. But Likud and its traditional political allies were in command of a 65-55 majority in the Knesset, Israel’s parliament.

Blue and White, led by former military chief of staff Benny Gantz and Yair Lapid, a former Netanyahu Cabinet minister, got about 26% of the vote — a shade less than Netanyahu’s Likud.

The outcome affirmed Israel’s continued tilt to the right and further dimmed hopes of a negotiated solution to the Israeli-Palestinian conflict. It also will give Netanyahu an important boost as he braces for the possibility of criminal charges in corruption scandals.

President Donald Trump called Netanyahu to congratulate him, saying that with the victory, “I think we’ll see some pretty good action in terms of peace.”

Lapid vowed that Blue and White would “embitter the lives” of Netanyahu and his allies from the opposition, and push for investigations into other allegations of corruption by the premier.

“We are going to turn the Knesset into a battleground,” Lapid said.

Two of Netanyahu’s potential allies, hawkish former Defense Minister Avigdor Lieberman and economic-centric Finance Minister Moshe Kahlon, have yet to formally confirm they would sit with Netanyahu and could emerge as wild cards. In any case, the country faces what could be weeks of political negotiations over the composition of a ruling coalition.

But under nearly every scenario, Netanyahu was the big winner.

He had fought a tight race against Gantz, whose new party emerged as a viable alternative to Netanyahu’s decade in power. But most of its support seems to have come at the expense of the Labor and leftist Meretz parties, which both earned historic lows in the election.

The spotlight now falls on President Reuven Rivlin, who will consult with party representatives next week before picking the candidate with the best chance of assembling a parliamentary majority.