Fire caused by clashes between Islamic State militants and guards near Libya's biggest oil ports have spread to four oil storage tanks that were still burning on Wednesday, guards spokesman said.

Ali al-Hassi said the Petroleum Facilities Guards were in control of Es Sider and Ras Lanuf ports, but that skirmishes continue.

Hassi said guards had recovered bodies of 30 Islamic State fighters, and had also captured two military tanks and other vehicles from the militants.

Firefighters were trying to control three fires at Es Sider and one at Ras Lanuf.

Two blazes were triggered by shelling from Islamic State, and fire had spread to two more, Hassi said.

Es Sider and Ras Lanuf have been closed since December 2014.

They are located between city of Sirte, which is controlled by Islamic State, and the eastern city of Benghazi.

Libya is split between rival political factions and armed groups competing for power and for the country's oil wealth, four years after the revolt that toppled Muammar Gaddafi.

Since then oil output has dwindled to around 400,000 barrels per day from slightly over one million bpd.

Islamic State has profited from a security vacuum to expand its presence, though it has not taken control of oil installations in the country.