By Jeffrey Heller and Dan Williams

JERUSALEM (Reuters) - Prime Minister Benjamin Netanyahu claimed victory in Israel's election after exit polls showed he had erased his center-left rivals' lead with a hard rightward shift in which he abandoned a commitment to negotiate a Palestinian state.

Difficult coalition talks still lie ahead. Isaac Herzog, Netanyahu's chief opponent and head of the center-left Zionist Union, said "everything is still open" and that he already had spoken to party leaders about forming a government.

But after days in which Zionist Union appeared poised to defeat Netanyahu's Likud, the exit polls late on Tuesday put the two parties in a dead heat. Netanyahu could have the easier path to forming a cabinet, which would put him on course to becoming Israel's longest serving leader.

He pulled off the feat with a pitch for ultranationalist votes in the final days of the hard-fought campaign, using tactics that could deepen a feud with the White House, at least as long as President Barack Obama remains in office.

Netanyahu has focused on the threat from Iran's nuclear program and militant Islam. But many Israelis had said they were tiring of the message, and the center-left campaigned on social and economic issues, surging in polls as election day neared.

An exit poll for Channel 2 TV gave Likud 28 seats and Zionist Union 27 in the 120-member parliament. Channel 10, revising its survey several hours after voting ended, put that margin at 27 seats for Likud to 26 for Zionist Union. Channel 1 had both parties tied at 27.

"Against all odds: a great victory for Likud," a beaming Netanyahu told cheering supporters in a speech at party election headquarters in Tel Aviv. He said he had spoken to leaders of other right-wing parties and urged them to form a "strong and stable" government with him without delay.

"He's a magician, he's a magician," the crowd chanted.

Opinion polls in the run-up to the ballot had shown Zionist Union with a three- to four-seat advantage over Likud, suggesting the public had warmed to Herzog, who won over voters with flashes of wit after enduring being lampooned for his short stature and reedy voice.

Story continues

Final results are not expected until early on Wednesday.

COALITION BLOCS

A new centrist party led by former communications minister Moshe Kahlon could be the kingmaker in coalition talks. After the balloting ended, he said he did not rule out a partnership with either Likud or Zionist Union.

The exit polls gave right-wing and religious parties - Netanyahu's traditional partners - about 54 seats, and left-leaning factions, 43 - both figures still short of a governing majority in the 120 seat parliament.

Turnout was around 72 percent, higher than the last election in 2013.

No party has ever won an outright majority in Israel's 67-year history, and it may be weeks before the country has a new government. Netanyahu will remain prime minister until a new administration is sworn in.

Naftali Bennett, leader of the ultranationalist Jewish Home party, said he had spoken with Netanyahu within minutes of the exit polls and agreed to open "accelerated" coalition talks with him.

"The nationalist camp won," Bennett, who advocates annexing parts of the occupied West Bank, told supporters.

But Zionist Union could find a lifeline from Kulanu and from Arab parties that united for the first time in a joint list of parliamentary candidates and came in third in the exit polls.

While they are unlikely to join a government, the Arab parties could give a center-left coalition tacit support and create a block against Netanyahu.

If the center-left is to assemble a government, it will also need the support of ultra-Orthodox parties, which the polls said would win 13-14 seats.

After the final results are in, and following consultations with political parties, it will be up to President Reuven Rivlin to name the candidate he deems best placed to try to form a coalition. The nominee will have up to 42 days to do so.

Rivlin has called for national unity, signaling he favors a government that would pair both Likud and Zionist Union.

Ramping up his bid for right-wing votes, Netanyahu on election day accused left-wing groups of trying to remove him from power by busing Arab Israeli voters to polling stations, a statement that drew a sharp rebuke from Washington.

"We’re always concerned, broadly speaking, about any statements that may be aimed at marginalizing certain communities,” State Department spokeswoman Jen Psaki said.

Some political rivals accused Netanyahu of racism over the remarks.

The Obama administration has been angry at Netanyahu since he addressed the U.S. Congress two weeks ago at the invitation of Republican lawmakers, to oppose ongoing U.S. nuclear negotiations with Iran.

In the last days of campaigning as he sought to persuade supporters of smaller right-wing parties to "come home" to Likud, Netanyahu promised more building of Jewish settlements and said the Palestinians would not get their own state if he were re-elected.

Those sweeping promises, if carried out, would further isolate Israel from the United States and the European Union, which believe a peace deal must accommodate Palestinian demands for a state in the occupied West Bank, East Jerusalem and Gaza.

When Netanyahu called the election in December, two years early, he looked set for an easy victory. But in the final weeks there has been a sense that change could be in the air. Some voters spoke of Netanyahu fatigue.

Saeb Erekat, chief Palestinian negotiator in peace talks with Israel that collapsed in April, told Reuters: "It seems to me that Mr. Netanyahu will form the next government in Israel and we all heard what he said yesterday ... Mr. Netanyahu has done nothing in his political life but to destroy the two-state solution."

(Additional reporting by Luke Baker, Maayan Lubell, Allyn Fisher-Ilan and Ori Lewis; Editing by Peter Graff and Howard Goller)