Growing isolation has pushed Hamas into ceding control of Gaza to the Fatah faction of President Mahmoud Abbas, shoring up Palestinian demands for statehood.
Rival Palestinian factions Hamas and Fatah have signed a reconciliation deal after Hamas agreed to hand over administrative control of Gaza, including the key Rafah border crossing, a decade after seizing the enclave in a civil war.
The deal brokered by Egypt bridges a bitter gulf between the Western-backed mainstream Fatah party of Palestinian President Mahmoud Abbas and Hamas, an Islamist movement designated as a terrorist group by Western countries and Israel.
Palestinian unity could also bolster Abbas's hand in any revival of talks on a Palestinian state in Israeli-occupied territory. Internal Palestinian strife has been a major obstacle to peacemaking, with Hamas having fought three wars with Israel since 2008 and continuing to call for its destruction.
Hamas's agreement to transfer administrative powers in Gaza to a Fatah-backed government marked a major reversal, prompted partly by its fears of financial and political isolation after its main patron and donor, Qatar, plunged in June into a major diplomatic dispute with key allies like Saudi Arabia. They accuse Qatar of supporting Islamist militants, which it denies.
Israel viewed the Palestinian accord warily, saying it must abide by previous international agreements and terms set out by the Quartet of Middle East peace mediators - including the recognition of Israel and the disarming of Hamas.
"Israel will examine developments in the field and act accordingly," said a statement from Prime Minister Benjamin Netanyahu's office.
Thousands of Palestinians took to the streets across Gaza on Thursday in celebration of the unity pact, with loudspeakers on open cars blasting national songs, youths dancing and hugging, and many waving Palestine and Egyptian flags.
Egypt helped mediate several previous attempts to reconcile the two movements and form a power-sharing unity government in Gaza and the West Bank, where Abbas and the Fatah-led Palestinian Authority are based.
Hamas and Fatah agreed in 2014 to form a national reconciliation government, but the deal soon dissipated in mutual recriminations with Hamas continuing to dominate Gaza.
"The legitimate government, the government of consensus, will return according to its responsibilities and according to the law," Fatah delegation chief Azzam Al-Ahmed said at the signing ceremony in Cairo.
He said the unity government would "run all institutions without exception," including all border crossings with Israel and in Rafah, Gaza's only access point with Egypt.
The agreement calls for Abbas's presidential guard to assume responsibility of the Rafah crossing on November 1, and for the full handover of administrative control of Gaza to the unity government to be completed by December 1.
Delegations from the two rivals have been in talks in Cairo this week to work out the details of the administrative handover, including security in Gaza and at border crossings.