A deal between the two organisations, bitter adversaries for four years, was agreed in Cairo on Wednesday after a series of secret meetings brokered by Egypt.
The two sides said "all points of differences have been overcome", and an interim national unity government would be established, leading to Palestine-wide presidential and parliamentary elections within a year.
The Israeli government immediately sounded the alarm over the prospect of having to deal with Hamas. "The Palestinian Authority must choose either peace with Israel or peace with Hamas. There is no possibility for peace with both," said prime minister Binyamin Netanyahu.
The US, which hopes to facilitate a peace deal between Israel and the Palestinians this year, reacted cautiously to the news. "The United States supports Palestinian reconciliation on terms which promote the cause of peace. Hamas, however, is a terrorist organisation which targets civilians," said a spokesman. Any Palestinian government must renounce violence and recognise Israel's right to exist if it is to play a constructive role, he added.
The details of the deal, expected to be formally signed in Cairo next week, were not spelled out. But Hamas said it included a combined security force and the release of prisoners held by both sides, as well as a unity government and elections.
The unexpected accord follows mounting pressure in Gaza and the West Bank, driven by non-affiliated youth groups, for reconciliation between the factions. Large demonstrations calling for unity were held in March, with more planned for May.
The youth groups were inspired by pro-democracy movements in the region, principally in Egypt, which has close ties to Gaza. The strength of mood alarmed the factions' leaders, who sought to co-opt the protests in an attempt to contain them.
The deal is likely to be viewed with suspicion by extreme hardline Islamist groups in Gaza, who have accused Hamas of abandoning armed resistance against Israel under its de facto ceasefire agreement. Such groups may try to sabotage the agreement by launching violent attacks on Hamas and Fatah as well as Israel.
Fatah, the largest group of the Palestinian Liberation Organisation, and Hamas have failed to find a way of working together since Hamas won legislative elections in 2006. Disagreement escalated into a violent confrontation in which Hamas defeated forces of the Fatah-dominated Palestinian Authority in 2007.
Hanan Ashwari, a veteran Palestinian legislator, said: "Every Palestinian will be delighted by this agreement which will signal a new phase in internal Palestinian relations. It's good for peace and stability and it's good for the region and democracy. This will help us heal the rifts and empower all Palestinians to end the occupation and embody statehood."
Hassan Zomlot, a senior Fatah official, said the deal was "great news for Palestinians". He added: "I hope the international community will react positively because political unity, combined with the institutional reform that we have been working hard at, will bring about the establishment of a Palestinian state."
Netanyahu warned that the deal could lead to a Hamas takeover of the West Bank. "Hamas aspires to destroy the state of Israel and says so explicitly. The idea of reconciliation with Hamas demonstrates the weakness of the Palestinian Authority and makes one wonder whether Hamas will seize control of [the West Bank] the way it seized control of the Gaza Strip," the Israeli prime minister said.
The US and EU both view Hamas as a terrorist organisation although both have had informal contacts with representatives of its government. When Hamas took over the government in 2006, the EU and the US refused to fund the Palestinian Authority, which resulted in staff not being paid for almost a year.
However, Hamas's continued hold on the Gaza Strip and its successful imposition of law and order have persuaded many international diplomats and commentators that peace between Israel and Palestinians is impossible without its involvement.
Hamas has taken over governmental roles in the Gaza Strip but it also maintains armed forces, in regular conflict with Israel. In recent months scores of Palestinians have been killed in Israeli artillery and air strikes.
Fatah is seen as the more secular organisation, which has supported the Oslo Accords which led to the formation of the Palestinian Authority in 1994. Hamas, an Islamic group, opposed the Oslo Accords and continues to refuse to honour past agreements with Israel.
The accord agreed on Wednesday was first reported by Egypt's intelligence service, which brokered the talks. In a statement carried by the Egyptian state news agency Mena, the intelligence service said the deal was negotiated by a Hamas delegation led by Moussa Abu Marzouk, deputy head of the group's political bureau, and Fatah Central Committee member Azzam al-Ahmad.
"The consultations resulted in full understandings on all points of discussions, including setting up an interim agreement with specific tasks and to set a date for election," the statement said.