Rival armed factions are fighting for control over crucial oil terminals in the east of Libya.
The forces of military strongman Khalifa Haftar, who have controlled the "oil crescent" since September, lost ground, their spokesman says.
He said they had carried out air strikes against a faction known as the Benghazi Defence Brigade (BDB), after it launched an attack on Friday.
Four oil terminals in the area provide much of Libya’s export income.
Libya remains regionally split with two centres of power that politically oppose each other, and a myriad of rival armed groups that the country’s two governments cannot control.
Field Marshal Khalifa Haftar is allied to an administration based in the eastern city of Tobruk, which is challenging the authority of the UN-backed unity government based in Tripoli.
His forces, known as the Libyan National Army (LNA), have been battling Islamist and other militias in the area since forcing them out of much of the country’s second city, Benghazi, in February 2016.
Oil exports resumed after the LNA took over the four terminals of Zuitina, Brega, Ras Lanuf and Sidra six months ago, giving a strong boost to the country’s output after a blockade of nearly two years.
Libya’s oil facilities, airports and other vital infrastructure have, in part, been at the centre of a battle of wills between rival armed factions for years now.
Observers have been warning of the dangers of a looming war in the oil crescent for months, and the need for local and international players to prioritise defusing tensions there.
This latest move by the so-called Benghazi Defence Brigade is ultimately motivated by a need for territorial gains to remain a relevant stakeholder in whatever shape Libya’s future takes. This is what all of Libya’s armed groups are fighting for.
It will be difficult for the BDB to maintain its ground there, or to push further east.
However, this latest shift is a dangerous one that raises the prospects of a wider war that the country cannot afford politically, or financially.
The stakes are high in this particular battle because it affects everyone - oil is Libya’s lifeline.
It remains unclear exactly how much control the BDB has gained.
A diplomatic source, who asked not to be named, told the BBC that it had overrun much of the oil crescent including Sidra, Ras Lanuf and Naufliya, but this cannot be independently confirmed.
The spokesman of the LNA, Col Ahmad al-Mismari, said on Friday that it had retreated to avoid civilian casualties.
On Saturday, he said the group had lost control of Ras Lanuf’s main airfield, AFP news agency reports.
Another LNA official, Col Moftah al-Megarief, told AFP late on Saturday that the groups’ forces were "gathering and preparing to take back Ras Lanuf".
"The ports are closed and most of the engineers returned to their homes," a port official in Ras Lanuf told Reuters.
"According to workers who left yesterday [the BDB] entered with their vehicles and stationed themselves in front of the ports of Ras Lanuf and Es Sider."
The BDB is composed of a mix of armed groups, including Islamists, tribal-affiliated militias from the east who oppose Field Marshal Hafter and an armed group that previously controlled the oil crescent.
Libya’s National Oil Corporation held an urgent meeting on Saturday to review crude loading schedules and emergency measures to protect oil facilities in response to the fighting.