Under the deal, brokered by Egypt, a new unity government will take administrative control of Gaza in December.
If the deal holds, it would end a decade-long rift that began with violent clashes between the two groups in 2007. Fatah, the party of Palestinian Authority President Mahmoud Abbas, governs the West Bank, while Hamas runs Gaza.
The two factions had started reconciliation talks in Cairo on Tuesday.
Senior Hamas member Saleh al-Arouri told a Cairo news conference that Hamas was determined to end the division between it and Fatah, saying they had "no choice but to continue to advance the unity of [the Palestinian people] and reach our hopes and aspirations."
He thanked Egypt for its role in facilitating the agreement.
The Palestinian Authority will assume control of all border crossings into Gaza -- from Israel and Egypt -- by November 1, senior Fatah member Azzam al-Ahmad told the Cairo news conference. The new unity government is then slated to take full responsibility for Gaza a month later, according to a statement from Egypt's State Information Service.
Further details of the deal reached between Fatah and Hamas were not disclosed. Control of Gaza's borders was one of a number of issues on which the two sides had previously disagreed.
News of the potentially landmark deal emerged on social media early Thursday.
"The head of the Hamas political bureau, Ismail Haniyeh, announced that an agreement was reached at dawn today between Fatah and Hamas," Hamas media spokesman Taher al-Nouno posted on his Facebook page.
Fatah Central Committee member Zakaria al-Agha wrote on Facebook: "The dark division has ended. Thank God and our congratulations to our Palestinian people everywhere."
It remains unclear how this agreement addresses points where previous reconciliation attempts are believed to have fallen apart.
The Palestinian Authority had demanded, for example, that Hamas disband its military wing and relinquish security control to the Palestinian Authority, a point Hamas had refused to concede.
One day before the latest round of talks began, Abbas told a Fatah Revolutionary Council meeting that reconciliation was a "priority that we seek to achieve by all means possible."
He said the two sides were going to Cairo "resolved and determined to make it happen and achieve concrete results in that respect."
Their meeting followed a round of Egyptian-led indirect talks in Cairo in mid-September.
Ray of hope
The detente between Fatah and the Islamist Hamas could mean the end of a rift between the West Bank and Gaza that started in 2007, after Hamas violently evicted the Palestinian Authority from the coastal enclave.
Earlier this month, Palestinian Prime Minister Rami Hamdallah, entering Gaza for the first time in two years, promised to heal divisions and improve the lives
of Gazans, who have been living under an Israeli-Egyptian imposed blockade and failing infrastructure damaged after several wars with Israel.
Two weeks earlier, Hamas had announced it would disband its Gaza "administrative committee
"-- established earlier this year and seen as a direct challenge to the Palestinian Authority, allowing a Palestinian unity government to work in its place and move toward general elections.
The talks had their roots in a 2011 meeting aimed at reconciliation, also mediated by Cairo.
Israel has not yet responded to Thursday's announcement by Fatah and Hamas.
However, the biggest single issue for Israel will likely be Hamas' weapons. As long as Hamas holds on to its arms, Israel is unlikely to regard Palestinian reconciliation as a game-changer in terms of Israeli policy on peace talks.
This is also true for Hamas' network of tunnels, running from Gaza into southern Israel and into Egypt. Israel will want to know they have been destroyed and that the Palestinian Authority is properly in control of the Gaza border.
A third major issue is Hamas' commitment to the destruction of Israel. Unless Hamas recognizes Israel's right to exist, Israeli politicians will not regard reconciliation as making a difference in terms of peace negotiations.
Prime Minister Benjamin Netanyahu set out the Israeli position clearly last week in remarks following Hamdallah's visit to Gaza, but did not dismiss the reconciliation efforts outright.
"We expect everyone who talks about a peace process to recognize the State of Israel and, of course, to recognize a Jewish state and we are not prepared to accept bogus reconciliations in which the Palestinian side apparently reconciles at the expense of our existence," he said.
"Whoever wants to make such a reconciliation, our understanding is very clear: Recognize the State of Israel, disband the Hamas military arm, sever the connection with Iran, which calls for our destruction, and so on and so forth. Even these very clear things must be clearly stated."
Netanyahu's response, less dismissive than regards previous efforts, likely reflects Israel's relations with Egypt and with the United States.
Egypt is a key partner for Israel following the peace deal signed between the two states almost 40 years ago. The fact that Egyptian President Abdel Fattah el-Sisi has played such a central role in advancing this reconciliation makes it difficult for Netanyahu simply to push it away.
The Americans, too, have given the reconciliation efforts their blessing.
In a statement released during Hamdallah's Gaza trip last week, White House Special Representative Jason Greenblatt said the United States welcomed "efforts to create the conditions for the Palestinian Authority to fully assume its responsibilities in Gaza" and would be watching developments closely while trying to improve the humanitarian situation in Gaza.
"The United States stresses that any Palestinian government must unambiguously and explicitly commit to non-violence, recognition of the State of Israel, acceptance of previous agreements and obligations between the parties, and peaceful negotiations," Greenblatt said.
Hamas' arms are as big a concern for Abbas as they are for Netanyahu.
Last week, Abbas gave an interview to Egyptian television in which he said he did not want Hamas in Gaza to replicate Hezbollah's role in Lebanon; in other words, controlling the military and security environment, while the Palestinian Authority looks after political affairs and civil society.
Gaza crisis looming
The push for reunification comes as Gaza faces a mounting humanitarian crisis.
The United Nations has warned the coastal enclave may be unlivable by 2020. Electricity is available for only a few hours a day.
Barely one in 10 residents has access to safe drinking water through the public water network, and the United Nations projects that Gaza's aquifer may become unusable at the end this year.