Khaled Meshaal, the exiled head of Hamas, will not be the cabinet's deputy head, but all positions except the ministry of interior had apparently been agreed on by Thursday.
Ziyad Abu Amr, an independent MP, is the new foreign minister while Salam Fayyad, from the Third Way party, becomes finance minister.
The remaining ministerial posts include nine ministers from Hamas and six from Fatah.
Four other ministerial posts will be distributed among other Palestinian factions.
Five posts will be assigned to independent politicians not belonging to any political faction. Three of the independents will be nominated by Hamas and two by Fatah.
The Fatah and Hamas delegates discussed the selection of ministers for a coalition cabinet, in particular those who will occupy the powerful interior ministry.
The two sides also discussed how the government's programme will address existing peace accords with Israel.
Hamas, which has long rejected Israel's existence, has declined calls for it to declare its "commitment" to the accords, regarding that as equal to recognition of Israel.
"It is pitiful to witness the bloody scenes in Gaza between the brothers"
But Nabil Amr, a spokesman for the Fatah delegation, said: "We don't have a problem in accepting the wording 'respect' in the agreements.
"We have informed the Saudis and our brothers in Hamas that we are ready to sign any phrasing accepted by the world for the sake of lifting the siege."
Tzipi Livni, the Israeli foreign minister, said on Wednesday that her country would not accept a Palestinian government that does not explicitly renounce violence and accept the right of Israel to exist.
Whether the agreed coalition government that emerges from Mecca is acceptable to Israel remains to be seen.
Israel has refused to talk to the Hamas-led government, though it has held talks with Abbas.
Fatah officials have said that Abbas has underlined the need for flexibility about a new government to the US, Israel's key ally.
Abbas; Ehud Olmert, the Israeli prime minister; and Condoleezza Rice, the US secretary of state, are due to meet on February 19 in Jerusalem for talks intended to revive the peace process.
Mohammed Nazal of the Hamas delegation said: "The atmosphere is positive."
|Abbas, left, and Meshaal say they will not leave |
Mecca until they have an agreement [EPA]
When delegates arrived in Saudi Arabia on Tuesday night, the Palestinian leaders declared that they could not afford to fail to reach an agreement.
Meshaal said: "We came here to agree and we have no other option but to agree."
Siraj Wahab, a journalist in Mecca, said: "There is every possibility that a comprehensive settlement will come out. And now they are answerable to their people.
"They have committed a major pledge before their people and before the holy Kaaba – that is a huge significance."