The driver of the Jordanian ambassador was killed and six people were wounded in the worst internal fighting on Monday in recent weeks.
The Hamas and Fatah leaders were brought together by Egyptian mediators after which they both condemned the driver's killing and sent condolences to the Jordanian people and to King Abdullah.
They agreed to hold daily meetings to try to calm tensions and sent a message to their respective fighters that they would not protect them if they violated public order.
Hamas and Fatah accused each other of starting the battle.
After more than two hours of fighting, sporadic shots still echoed throughout the largely deserted streets of the seaside city.
Some witnesses said members of the new Hamas-led militia returned fire after coming under attack.
Hamas officials said the assailants were from the Preventive Security agency, staffed by men loyal to Fatah.
Ordinary police also joined the battle, witnesses said.
At one point, Hamas fighters holed up in an abandoned building fired grenades at police.
Others took up positions behind trees, cars and buildings, turning downtown Gaza into a battle zone. Some of the fighters carried rocket-propelled grenade launchers.
Abu Zuhri said Hamas forces
were defending themselves
Tawfiq Abu Khoussa, a spokesman for Fatah, said security would worsen if Hamas kept its new force on Gaza's streets in defiance of the Palestinian president's orders to disband it.
He accused Hamas fighters of firing rocket-propelled grenades at police headquarters in Gaza during Monday's clash.
But Sami Abu Zuhri, a Hamas spokesman, said the Hamas force members were defending themselves after coming under attack.
Monday's battle was the most intense in a bloody confrontation between fighters loyal to the Hamas government and the Palestinian security forces allied with Mahmoud Abbas, the Palestinian president.
The Hamas government deployed a 3,000-strong armed force last week, raising tensions.
The man killed on Monday was identified as Khaled Radaida, 45, the driver of the Jordanian ambassador in Gaza.
Three bullets hit the windshield as Radaida was driving near the gun battle.
The gun battle was the worst
fighting in recent weeks
The ambassador, Yehiyeh Karala, was not in the car at the time.
Jordan called on the Palestinian Authority to open an inquiry into the killing, an official in Amman said.
Radaida's death brought to eight the number of people killed in internal fighting in Gaza this month.
Abbas is expected to lead talks with all the Palestinian factions starting on Thursday in an effort to calm the tensions.