The meeting took place in a "positive and constructive" spirit, UN special envoy Bernardino Leon, who has been trying to bring the two sides together for weeks and who chaired the talks, told a press conference. The discussions will continue Friday.
Libya has been wracked by conflict since the 2011 armed uprising against Moamer Kadhafi, with two governments and powerful militias battling for control of key cities and the North African country's oil riches.
The talks in Skhirat, near the Moroccan capital Rabat, come after delays caused by deadly jihadist attacks that prompted the internationally recognised government to pull out of discussions before returning.
The two sides are "fully aware" of the urgency of the situation, Leon said.
Libya's internationally recognised parliament is based in the eastern city of Tobruk while the rival Islamist-backed General National Congress is in the capital Tripoli.
The meeting was part of an attempt to "find an agreement between the different parties on a national personality to lead a national unity government," one participant told AFP.
The next step was to name "ministers who will represent the different parties," said the official, who spoke on condition of anonymity.
Signup to our newsletter and follow us on Facebook and Twitter!
A spokesman for Leon's mission to Libya, Samir Ghattas, told AFP the talks would also focus on security, aiming for a halt to fighting to ease efforts to form a unity government.
In a briefing ahead of the meetings, Leon told UN chief Ban Ki-moon the aim was to form a unity government and "address security arrangements to pave the way for a comprehensive ceasefire" as well as complete the constitution-drafting process.
The meeting comes as the internationally recognised government pushes for the lifting of an arms embargo to help it fight jihadists, amid growing alarm over the threat from the Islamic State group.
On Wednesday, the National Oil Company declared force majeure at 11 oil fields after Islamist attacks, in a legal step protecting it from liability if it cannot fulfil contracts for reasons beyond its control.
Members of the UN Security Council are reluctant to lift the arms embargo due to fears they might end up in the wrong hands, according to diplomats.
But they are not opposed to relaxing some conditions of the weapons ban once a unity government is formed through national dialogue.
"The solution is not to supply more arms because there are enough on the ground," said the German ambassador to Libya, Christian Mokh, attending the Morocco talks as an observer.
In addition to the Morocco meetings, the United Nations has invited representatives of Libyan political leaders and activists to more talks in Algeria next week.