JERUSALEM—Israel’s new government lost a parliamentary vote early Tuesday to extend a temporary law that bars citizenship for Palestinians from the occupied West Bank and Gaza who are married to Israelis, an early setback for the fragile ruling coalition.

The vote ended in a tie following a long night of debate, requiring a simple majority for the law to be extended. Fifty-nine lawmakers voted for it and 59 against in the 120-member Knesset.

The law, which was first enacted in 2003 and has since been renewed every year, is set to expire Tuesday at midnight. The failure to extend it exposes the deep ideological differences within the broad coalition. Two Arab lawmakers in the coalition abstained from the vote and a member of Prime Minister Naftali Bennett’s right-wing Yamina party voted against the law.

At the last minute, Mr. Bennett declared the vote would also be a confidence motion on the government. It survived because such a vote would require an absolute majority to fail.

Israel’s left-wing and Arab lawmakers, including many in the current government, say the so-called citizenship law discriminates against the country’s Arab minority. The right-wing parties, including that of Mr. Bennett, say the measure is needed to maintain security and preserve Israel’s Jewish character.

The failure to extend the citizenship law or win the confidence vote is the first major blow for the new ruling coalition, which is made up of eight parties considered left- and right-wing and includes the first independent Arab faction in government.

Demonstrators protested against the Israeli citizenship law outside the Knesset on June 29.

Demonstrators protested against the Israeli citizenship law outside the Knesset on June 29.

Photo: menahem kahana/Agence France-Presse/Getty Images

Former Prime Minister Benjamin Netanyahu’s Likud party, which for years backed the law on security grounds, voted against it. Now an opposition leader, he said before the vote that it was more important to frustrate the government.

“The opposition…failed to topple the government, but together they directly harmed the security of Israel and abandoned its borders,” Mr. Bennett’s Yamina party said after the vote.

Interior Minister Ayelet Shaked, a senior member of the Yamina party, said in a tweet Tuesday that the failure to pass the law would lead to 15,000 requests from Palestinians who are married to Israelis, mostly Arab citizens, to seek permanent residency and citizenship.

Gadi Wolfsfeld, a political scientist at IDC Herzliya, a nonprofit Israeli university, said, “I don’t think the right-wing can celebrate the fact that they opposed a law that they favored ideologically merely to embarrass the government.”

The failure to renew the law isn’t expected to change the lives of Palestinians practically in the short term. Israel will still be able to refuse individual citizenship applications from Palestinians at an administrative level, rather than via legislation, analysts said.

Relate Video

Israelis celebrated Sunday night as the parliament approved a new coalition, ending former Prime Minister Benjamin Netanyahu’s 12-year rule. His supporters gathered to cheer the country’s longest-serving leader as he takes on a new role as political opponent. Photo: Ariel Schalit/Associated Press The Wall Street Journal Interactive Edition

In its first few weeks, the government has faced some difficult obstacles. Last week, it reached a deal to legalize an unauthorized settlement in the occupied West Bank, possibly within months, if the land is found not to belong to Palestinians. That agreement was viewed as a compromise that appeased the coalition’s right-wing parties while forcing an evacuation that placated the left-wing factions.

First introduced as a temporary measure during a Palestinian uprising that saw attacks against Israelis, its proponents say the citizenship law is essential to protect Israel from militants they fear could seek to infiltrate the country by marrying an Israeli citizen.

In recent weeks, the new government nixed planned votes on the law as the Arab faction and the left-wing parties indicated they would vote against it. Right-wing coalition members met in recent weeks with partners who oppose the law to find a compromise.

Those efforts continued early into Tuesday morning, when the coalition said it had reached a last-minute compromise. The law would be extended only by half a year rather than a full year, hundreds of Palestinians married to Israelis for many years would be granted residency status and 1,600 more granted residency rights through visas, it said. But it still failed to win the vote to extend the law.

Mr. Netanyahu’s Likud party in a statement following the vote called the late-night compromise “a corrupt deal hatched in the dark of the night.”

The law has affected tens of thousands of families in Israel and the West Bank, preventing Palestinians from legally moving to join their spouses, according to the Legal Center for Arab Minority Rights in Israel, a nongovernmental organization.

Write to Rory Jones at rory.jones@wsj.com