The leaders met in a room overlooking Islam's holiest shrine
Leaders of Palestinian rivals Fatah and Hamas have opened crisis talks in Saudi Arabia's holy city of Mecca.
They hope to re-start negotiations on forming a national unity government and resolve differences that have threatened to ignite civil war.
Hamas leader Khaled Meshaal said they would stay until agreement was reached. A Fatah official said this could be done within 48 hours.
More than 20 people died in clashes between the two sides last week.
"We will not leave this holy place until we have agreed on everything good, with God's blessing," Mr Meshaal said.
The talks were expected to continue through the night.
They began several months ago, but have repeatedly broken down amid factional violence and disagreement over any new administration's policy towards Israel.
Fatah leader and Palestinian Authority President Mahmoud Abbas met Hamas leaders Mr Meshaal and Ismail Haniya around a table in a palace overlooking the Haram mosque, housing Islam's most revered shrine, the Kaaba.
Reported sticking points:
Wording of commitment to previous Israeli-Palestinian agreements
Post of interior minister
Areas of agreement:
Principle of forming unity government
Haniya to continue as PM
Foreign and finance ministries to be headed by independent candidates
"We want to create a unity government and that is everyone's demand. We want a government that can end the blockade," Mr Abbas said.
"Recent days have been very black and may God not allow them to return... We don't want blood spilt."
Later Nabil Amr, a spokesman for Mr Abbas, said general talks had been completed and the sides were now working on forming a new cabinet.
Both groups also met King Abdullah of Saudi Arabia, who called on them to respond "to the voice of reason".
Palestinians hope that a coalition administration will end the gun battles in the streets, present a more united front to Israel and encourage the big powers to lift devastating financial sanctions, says the BBC's Middle East editor Jeremy Bowen.
The biggest sticking points between Fatah and Hamas have been disputes over how to split the top jobs and the issue of recognising Israel, says Jeremy Bowen.
The two sides have been locked in a bitter power struggle since Hamas won legislative elections last year.
Hamas has so far refused to recognise Israel, renounce violence or honour previous agreements - all preconditions to end the Western aid boycott of the Hamas government.
Months of on-and-off talks between Hamas and Fatah have yielded few results.
Clashes between armed supporters of the two groups killed at least 80 people since December.
However, a shaky ceasefire has been holding since Saturday, after the latest round of violence flared last week.