* Rightist parties backing PM seen expanding majority

* Netanyahu facing possible corruption indictment

* Election seen as referendum on four-term reign (Recasts for official tally, market opening)

By Jeffrey Heller and Maayan Lubell

JERUSALEM, April 10 (Reuters) - Israeli Prime Minister Benjamin Netanyahu secured a clear path to reelection on Wednesday, with religious-rightist parties set to hand him a parliamentary majority despite a close contest against his main centrist challenger, a vote tally showed.

With more than 97 percent of votes counted, Netanyahu's conservative 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.

"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 centre-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.

IMMUNITY?

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 U.S. President Donald Trump, who delighted Israelis and angered Palestinians by recognising Jerusalem as Israel's capital in 2017 and moving the U.S. 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, recognising Israeli sovereignty over the occupied Golan Heights captured from Syria in the 1967 Middle East war.

In a rare turn during the race towards 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 U.S.-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. (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)

Our Standards: The Thomson Reuters Trust Principles.