The Israeli government on Saturday approved a cease-fire agreement with Hamas that sets in motion the release of hostages in the Gaza Strip and the freeing of Palestinian prisoners in Israel—though last-minute twists showed just how fragile the truce is.

In his first address to a skeptical Israeli public since the deal was approved, Prime Minister Benjamin Netanyahu emphasized the temporary nature of the cease-fire, with the first phase of the agreement set to begin Sunday at 8:30 a.m. local time in Gaza , or 1:30 a.m. Eastern Standard Time. He reiterated Israel’s determination to destroy Hamas, a U.S.-designated terrorist group, and said President Biden and President-elect Donald Trump both supported Israel’s right to return to fighting if talks on a permanent truce bore no fruit.

“I promise you—we will insist on all the objectives of the war,” Netanyahu said in a speech in Hebrew that was seen as a pitch to an Israeli public eager to recover 98 hostages still in Gaza, calibrated against political partners reluctant to end fighting with Hamas. “Both President Trump and President Biden have given full backing to Israel’s right to return to the fighting, if Israel reaches the conclusion that the second stage negotiations are ineffectual,” he said.

Trump, in an interview with NBC News on Saturday, said that he would be meeting with Netanyahu “fairly shortly” and that he told the prime minister in a recent conversation to “just keep doing what you have to do.” Biden hasn’t publicly commented on recent conversations with the prime minister.

Netanyahu’s office earlier had issued a statement blasting Hamas for not releasing the names of the hostages who would be released Sunday, a potential violation of the deal. Hamas warned that continuing Israeli bombing of Gaza was endangering hostages’ lives.

Still, Arab mediators who negotiated the agreement said they were confident the first phase would begin Sunday, and preparations intensified for the hostage and prisoner releases.

The first three hostages—likely all civilian women—will be released into the care of the International Committee of the Red Cross, the Swiss aid group that will facilitate their transfer out of Gaza on Sunday afternoon, according to the mediators. Four more hostages should be released the following weekend, and an additional 26 spread out over the following five weeks, in the first part of the multiphase deal.

Israel’s military set up three sites on its side of the Gaza border to receive hostages and provide initial treatment. Hospital teams will assess where to send them for further care, with the expectation that they will be suffering from severe weight loss, medical complications and psychological harm following more than 15 months of captivity in a war zone and often underground.

Around the same time Sunday, the first batch of around 90 Palestinian prisoners will be released and transferred by Israeli security forces to either the occupied West Bank or Gaza. More than 1,700 prisoners are set to be freed throughout the deal. The exact timing of the start of the cease-fire and the transfer of hostages and prisoners could still shift slightly based on logistics, people involved in the preparations warned.

Netanyahu on Saturday cautioned that Israel wouldn’t proceed with the cease-fire until it receives the list of names of hostages to be released on the first day.

Meanwhile, aid groups are preparing to use the cease-fire to increase deliveries into the besieged territory, where most of the population has been displaced repeatedly and faces extreme hunger and disease . The deal calls for 600 trucks of aid to enter Gaza each day and an easing of restrictions on the movement of aid workers inside the strip. Some 80,000 tons of food assistance, enough to feed one million people for three months, is on standby for entry into Gaza, according to the United Nations.

Hundreds of trucks have been lined up for months on the Egyptian side of the Gaza border, along with dozens of ambulances. Egyptian authorities are intensifying activities in the area, with two ministers dispatched from Cairo to oversee efforts that will eventually include repairing the Rafah border crossing. Injured Palestinians will be allowed to leave Gaza through Rafah starting the second week of the deal, and some Gazans will be permitted to return from abroad during a later phase.

Netanyahu said in his address Saturday that Israel would “keep full control” in the Philadelphi corridor along the Egypt-Gaza Strip border, and even slightly increase troop presence there. He also said Trump committed to lifting remaining restrictions on supplying weapons to Israel.

The cease-fire would be only the second reprieve in the war that began on Oct. 7, 2023, when Hamas-led militants attacked southern Israel , killing more than 1,200 people and taking some 250 hostages back into Gaza. Israel’s massive bombardment and ground invasion has badly weakened Hamas but also killed more than 46,000 Palestinians, according to Palestinian authorities, who don’t say how many were combatants.

A pause in November 2023 lasted for a week, resulting in the release of more than 100 hostages and hundreds of Palestinian prisoners. Efforts to extend that agreement failed, and both sides went back to fighting.

Palestinians are anxiously awaiting the start of the deal. “The remaining hours…are moving very slowly,” said Gaza resident Yahya Hisham. “We’re waiting and counting down as if waiting for Eid,” he said, referring to the annual Muslim feast.

Rafah Mayor Ahmad Al-Sufi said that once Israeli forces withdraw, municipal personnel will work around the clock to restore essential services and gradually clear streets of debris so that life can begin to return to normal. He urged displaced people sheltering in the southern city not to rush back to their areas before emergency crews could clear unexploded ordnance and other hazards.

A renewed cease-fire now could calm tensions across the Middle East after the Gaza conflict ignited wider hostilities, including a war between Israel and Hezbollah in Lebanon and the first-ever exchanges of direct fire between Israel and Iran last year.

The deal, though, leaves many issues unresolved, including who will ultimately run Gaza. Israel has said it won’t accept a Hamas presence in the enclave and is reinforcing positions along the border as it prepares to gradually withdraw forces to the edges of the territory.

The Gaza interior ministry said Saturday that its security teams were ready to deploy across the strip as soon as the cease-fire agreement goes into effect. The ministry has long been run by Hamas, which has been heavily degraded by the Israeli campaign but continues to recruit new fighters .

Limited numbers of Gaza police will resume responsibility internally, including for the movement of Palestinians from the strip’s south to the north, but aren’t permitted to approach Israeli military positions or carry weapons except under certain conditions, according to the mediators.

The Israeli military’s Arabic-language spokesman warned Gazans not to approach its soldiers, particularly along corridors, buffer zones and coastal areas. The military has said it is prepared to respond forcefully to any perceived threats to its troops inside Gaza, which are set to withdraw in phases over several months. It is unclear how it would view a public resurgence of police linked to Hamas.

“This is the least worst alternative,” said Michael Milshtein, former head of Palestinian affairs for Israeli military intelligence. “I think Israel will have to accept that.”

The deal consists of three phases, with an initial six-week pause allowing for further talks on a permanent end to the war. The third phase revolves around the return of remains and the long-term reconstruction of Gaza.

Israel says 94 hostages taken on Oct. 7, 2023, remain in Gaza, most of them Israeli. They include dual nationals and more than 30 hostages who Israel has concluded are no longer alive, based on intelligence, but Israeli and U.S. officials privately believe the number of dead is much higher. Four additional hostages, taken before the Hamas-led attack, bring the total to 98.

—Saleh al-Batati and Suha Ma’ayeh contributed to this article.

Write to Stephen Kalin at stephen.kalin@wsj.com and Summer Said at summer.said@wsj.com