The clashes are part of a struggle in the North African country between competing governments allied to armed factions, three-and-a-half years after the ouster of Muammar Gaddafi. At stake are control of Libya's government and the country's vast oil reserves.
The recognized prime minister, Abdullah al-Thinni, has been forced into eastern Libya since a group called Libya Dawn seized the capital of Tripoli in August and set up its own government and parliament.
The oil ports Ras Lanuf and Es Sider, two of Libya's biggest, accounting for more than 300,000 barrels a day of exports, were working normally, an oil official said.
Forces loyal to the rival government in Tripoli have launched an operation to take the oil ports and expel the forces of former army general Khalifa Haftar allied to Thinni, its commander Tarek Eshnaina told Reuters.
"We are a third force commissioned by the chief of staff Abdulsalam Jadallah and commander-in-chief Nouri Abu Sahmain," he said. Abu Sahman is head of the General National Congress (GNC), the rival parliament based in Tripoli.
"We were about one kilometer from the main gate of Es Sider oil port, but we had to withdraw about two kilometers after Haftar's planes carried out air strikes, which killed two of our members and wounded three," he said.
Saqer al-Joroushi, Haftar's air force commander, said his forces had attacked positions near Sirte, a central costal city, which was confirmed by residents.
He said a rival force coming from Misrata, a city west of Sirte and the ports, had advanced towards the terminals with a large number of cars.
The House of Representatives, elected in June and also now based in the east, said the attackers had been joined by the Islamist group of Ansar al-Sharia, which is fighting Haftar's troops in a separate battle in the eastern city of Benghazi.
Last month, Libya Dawn took El Sharara oilfield, which produces more than 340,000 bpd, in the south after a force allied to Thinni had withdrawn.