Israel and Hamas have agreed to a ceasefire in Gaza for at least four days to let in aid and release at least 50 hostages captured by militants in exchange for at least 150 Palestinians jailed in Israel.
The first truce in a brutal near seven-week-old war, reached after mediation by Qatar, was hailed around the world as a sign of progress that could ease the suffering of Gaza's civilians and bring more Israeli hostages home.
Israel said the ceasefire could be extended further as long as more hostages were freed.
Hamas and allied groups captured about 240 hostages when gunmen rampaged through southern Israeli towns on October 7. Previously, Hamas had released just four.
The official start of the truce is expected to be announced within 24 hours, with the first hostages to go free on Thursday.
Israeli Prime Minister Benjamin Netanyahu's office said 50 women and children would be released over four days at a rate of at least 10 a day.
Beyond that, the truce could be extended as long as an additional 10 hostages were freed per day.
It made no mention of the release of Palestinian detainees, but Israel's justice ministry published a list of 300 names of Palestinian prisoners who could be freed.
"Israel's government is committed to return all the hostages home. Tonight, it approved the proposed deal as a first stage to achieving this goal," the government statement said.
Hamas said the initial 50 hostages would be released in exchange for 150 Palestinian women and children held in Israeli jails.
Hundreds of trucks of humanitarian, medical and fuel supplies would enter Gaza, while Israel would halt all air sorties over southern Gaza and maintain a daily six-hour daytime no-fly window in the north, it said.
Israel has placed Gaza under siege and relentless bombardment since the Hamas attack, which killed 1200 people, mostly civilians, according to Israeli tallies.
Since then, more than 14,000 Gazans have been killed, about 40 per cent of them children, according to officials in the Hamas-ruled territory, figures deemed reliable by the United Nations.
Qatar's chief negotiator in ceasefire talks, Mohammed Al-Khulaifi, hoped the deal "will be a seed to a bigger agreement and a permanent cease of fire. And that's our intention."
Pending the start of the truce there was no let-up in fighting. As morning broke on Wednesday, smoke from explosions could be seen rising above northern Gaza in live Reuters video from across the fence.
Israel's military released video of soldiers shooting in narrow alleyways and said it had carried out air strikes.
The truce deal is a first small step towards peace in the most violent ruction of the 75-year-old Palestinian-Israeli conflict.
The past seven weeks have shocked the world because of the suffering of civilians on both sides, beginning with the killing of Israeli families and continuing with destruction rained down on Gaza, home to 2.3 million people.
Both Israel and Hamas said the truce would not halt their broader missions: "We are at war and we will continue the war until we achieve all our goals. To destroy Hamas, return all our hostages and ensure that no entity in Gaza can threaten Israel," Netanyahu said in a recorded message.
Hamas said: "As we announce the striking of a truce agreement, we affirm that our fingers remain on the trigger, and our victorious fighters will remain on the look-out to defend our people and defeat the occupation."
US President Joe Biden was among international leaders who welcomed the deal.
Three Americans, including a three-year-old girl whose parents were killed during Hamas's October 7 attack, were expected to be among the hostages to be released, a senior US official said.
More than half the hostages hold foreign and dual citizenship from some 40 countries.
Qadura Fares, head of the Commission for Prisoners' Affairs in the Ramallah-based Palestinian Authority, said that among more than 7800 Palestinians imprisoned by Israel were about 85 women and 350 minors.
The armed wing of the Palestinian militant group Islamic Jihad, which took part in the October 7 raid with Hamas, said one of the Israeli hostages it has held since the raid had died.