The two sides agreed "pull all gunmen from the streets and remove checkpoints, ... return all security forces to their positions and end all forms of tensions," reported Foreign Minister Mahmoud al-Zahar, following a meeting between Prime Minister Ismail Haniyeh of Hamas and a senior aide to President Mahmoud Abbas of Fatah.
The two sides also agreed to hand over those suspected of involvement in the killings to prosecutors for investigation, and prevent the bloodshed in Gaza from spilling over to the West Bank.
Rival factions held their fire as a truce began on Tuesday but gunmen remained on the streets of the Gaza Strip, witnesses and security sources said.
Previous ceasefires in the region have been short-lived - often lasting mere hours - including a theoretical truce mediated by an Egyptian security delegation only days ago.
"The president and the prime minister call on Hamas and Fatah to abide by the above mentioned agreement and to meet immediately to discuss all the remaining issues in preparation to resume the broad national meeting over the formation of a national unity government," Zahar said.
An ongoing feud
The recent violence has derailed unity government talks between Hamas and Fatah and prompted some families in the densely populated territory to flee their homes. Many shops and schools have been closed
On Sunday, Saudi Arabia invited the feuding factions for urgent talks in its holy city of Mecca. Both sides agreed to attend the meeting but no date was set, and the two sides spent much of Monday trading blame for the clashes.
Hamas accused Mohammad Dahlan, a Fatah strongman and security adviser to Abbas, of inciting the violence, a charge that Fatah rejected. Explosions and gunshots echoed across Gaza through the day.
A Hamas militant and a policeman loyal to Fatah died in separate gunbattles, hospital and security officials said. A 20-year-old Palestinian was also shot dead near the scene of one of the fiercest clashes.
On Monday night, a rocket-propelled grenade was fired at a police station in Gaza City. The attack, which a security source blamed on Hamas, was followed by bursts of heavy gunfire. There were no immediate reports of casualties.
Gunmen blew up a Fatah office and the home of an official from the group.
"What else can we call this but a civil war," said Abu Omar, a shop owner in Gaza City, where most businesses closed down.
At least 60 Palestinians have been killed in infighting since Abbas called last month for early presidential and parliamentary elections after inconclusive talks with Hamas regarding a Palestinian unity government. Hamas says the vote would amount to a coup.
In the Israeli city of Eilat, a Palestinian suicide bomber killed three people in a bakery Monday morning. It was the first such attack in nine months.
One of the groups claiming responsibility for the bombing, Islamic Jihad, said it was partly a message to Hamas and Fatah to unite against Israel.
Ali Waked contributed to this report