Libya's UN-backed government has signed a deal with an armed brigade controlling the major oil ports to end a blockade and restart exports.
The two major Ras Lanuf and Es Sider oil ports had shut down since December 2014.
Mousa Alkouni, Libyan Presidential Council deputy, signed the agreement late on Thursday with Ibrahim al-Jathran, commander of the Petroleum Facilities Guards, one of Libya's many armed brigades that has controlled the terminals.
"I think the resumption depends now on technical part and I think also it will happen from within a week to two weeks, but not more," Alkouni told Reuters news agency by telephone.
He said the agreement included paying an unspecified amount in salaries to Jathran's forces. He said they had not been paid wages for 26 months.
Opening the two oil ports would add a potential 600,000 barrels per day of capacity to the North African country's crude exports, though experts estimate damage from fighting and the long stoppage must be repaired before shipments are at full capacity again.
Since the 2011 fall of Muammar Gaddafi, Libya has slipped into chaos that has cut its oil output to less than a quarter of pre-2011 levels of 1.6 mn barrels per day.
Jathran's brigades led blockades of the ports starting in 2013, saying he was trying to prevent corruption in oil sales, though others disputed his motives.
Battle for Sirte
In a separate development, Libyan forces made a fresh push on Friday to capture ground from the Islamic State of Iraq and the Levant (ISIL, also known as ISIS) group's fighters in Sirte.
Nearly three months into a campaign to recapture the city, brigades mainly composed of fighters from nearby Misrata are waging sporadic street battles in residential areas where armed groups use snipers, mines and concealed explosives to defend their positions.
At least five brigade members were killed and 28 wounded in the fighting, medical officials at a nearby field hospital said.
The brigades advanced rapidly on Sirte after launching a counterattack against ISIL in early May, but their progress has slowed as they close in on the city centre.
Losing Sirte would be a major blow for ISIL, which established total control over the coastal city last year and expanded its presence along about 250km of sparsely populated land on either side.
Nearly all Sirte's residents have left the city, and shots and artillery fire ring out amid emptied buildings now used by both sides for cover.
More than 300 of the fighters have died and more than 1,500 have been wounded since the campaign began.
In the country's east, meanwhile, forces loyal to Khalifa Haftar, a former Libyan general who formed the self-declared Libyan National Army (LNA), have taken back control of a Benghazi neighbourhood from fighters, following months of fighting to drive them from the country's second city.
Benghazi, 1,000km east of Tripoli, has for the past two years been the scene of clashes between fighters and forces loyal to a government based in the far eastern city of Tobruk.
"We dealt them a firm blow, it's a major victory," Khalifa al-Obeidi, head of press for LNA, told AFP news agency Thursday.
"We are presently pursuing terrorists who are entrenched one kilometre east."
Six of Haftar's troops died in clashes this week in al-Gwarcha district, including four special forces killed by a landmine explosion.
As the self-appointed defence minister backed by the Tobruk administration, Haftar refuses to recognise the joint military command set up by the UN-backed Government of National Unity (GNA) in Tripoli.
France, Britain and the US recognise the GNA as the legitimate government of Libya.