Ismail Haniyeh, leader of Hamas, said that a deal had been struck after two days of talks brokered by Egypt.
In Israel's first reaction, a government official said Hamas must disarm and recognise Israel under the deal.
Israel's Prime Minister Benjamin Netanyahu and U.S. President Donald Trump chat as White House senior advisor Jared Kushner is seen in between them, during their meeting at the King David hotel in Jerusalem May 22, 2017.
A split between Palestine's two major forces, Fatah and Hamas, occurred after the parliamentary elections in Palestine in 2006 when Hamas won.
Egypt has been keen to improve security in the Sinai Peninsula which borders Gaza and where jihadist rebels have fought a long-running insurgency.
The agreement, which is a reactivation of a previous deal signed in 2011, was signed in the presence of Egyptian Intelligence Minister Khalid Fawzi.
Islamist movement Hamas is blacklisted as a terrorist organisation by the United States and the European Union.
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.
The readout of the Secretary-General's phone call comes as media outlets are reporting that Egyptian-facilitated talks in Cairo have led to a breakthrough in the talks among Palestinian parties on administration in the Gaza Strip.
A permanent opening of the Rafah crossing would mean an end to the crippling Gaza border blockade which prevents free trade and bars the vast majority of Gaza's 2 million people from leaving the territory.
The publicly-released parts of the agreement did not specify what would happen to Hamas' armed wing.
With Hamas in control, conditions in Gaza deteriorated. It also added that the Presidential Guard of President Mahmoud Abbas will operate the border, under a reconciliation deal.