Fawzi Barhoum, a Hamas spokesman in Gaza, said on Friday that an Egyptian security delegation had brokered the talks, which took place in the coastal strip.
Barhoum said: “These efforts have been crowned by an agreement between Hamas and Fatah to stop tensions between the two sides and to bring the security situation under control.”
Tawfiq Abu Khoussa, a Fatah spokesman, said that the two groups agreed to endorse dialogue as the only way to resolve differences.
“The agreement aimed at resolving internal violence and I hope it will be a serious start to remove tensions between the two movements,” Abu Khoussa told Reuters.
It was the first high-profile meeting in weeks between the two movements, whose power struggle sparked fighting this month in which at least 19 people were killed.
Barhoum said that as part of the agreement, a joint trouble-shooting office manned by members of both factions would be set up to resolve issues which may spill over into violence.
Officials said it could be set up as early as Friday.
Barhoum also said that the two sides agreed to end news conferences in which each faction accused the other of stoking tensions.
Earlier this week Ghazi Hamad, a senior figure in Hamas, published an article condemning internal violence and questioned whether it had become a “Palestinian disease”.
Hamas took power in March, after which the US and the EU imposed sanctions on its government, blocking direct aid and support on which the administration depended.
The measures were imposed because Israel, the US and the EU regard Hamas as a terrorist group. They say it must recognise Israel, renounce violence and respect existing peace agreements before sanctions can be lifted.
Weeks of talks between Mahmoud Abbas, Fatah’s Palestinian president, and Hamas on trying to form a unity government, and perhaps put an end to the violence, have so far failed.
Wary of triggering bloodshed, Abbas has so far resisted months of pressure from Washington to sack the government of Ismail Haniyeh, the prime minister.
But Abbas has hinted that he might sack the government and has said talks on forming a unity coalition with the Islamist movement were dead over its refusal to soften its stance toward Israel.
Abbas said this week he had to make a decision soon on the future of the Hamas government and that he might seek approval for any move in a referendum.