Under the agreement, the West Bank-based Palestinian Authority is to resume full control of the Hamas-controlled Gaza Strip by December 1, according to a statement from Egypt's government.
Egyptian President Abdel-Fattah el-Sissi said on Sunday the Egypt-backed reconciliation talks between the PA and Hamas are "preparation" for an Israeli-Palestinian peace deal.
In Israel's first reaction, a government official said Hamas must disarm and recognise Israel under the deal.
Cairo is now leading efforts to heal a decade-long political split between Gaza-based Hamas and the West Bank-based Fatah movement of Palestinian President Mahmoud Abbas.
The two factions, the same source continued, had also agreed to allow a legal and administrative committee, drawn up earlier in Ramallah, to find solutions to longstanding problems - mostly related to salary shortfalls - faced by Gaza's Hamas-hired civil servants.
Fatah negotiator Azzam al-Ahmed and Hamas' representative Saleh al-Arouri smiled and shook hands in a short ceremony presided over by Egypt's chief of intelligence, Khalid Fawzi.
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 official was referring to the diplomatic Quartet on Middle East peace, which includes the United Nations, the United States, the European Union and Russian Federation.
It has fought three wars with Israel since 2008 and the blockaded Gaza Strip has seen deteriorating humanitarian conditions.
Attempts at reconciliation in recent years fell apart.
Hamas has remained staunchly opposed to even discussing demilitarization, and in the past has called their military wing the "arms of the resistance" and argued "the resistance's weapons are legal". It also added that the Presidential Guard of President Mahmoud Abbas will operate the border, under a reconciliation deal.
With Hamas in control, conditions in Gaza deteriorated.