A truck-bomb attack on a police training centre in a western town in Libya has killed at least 65 people, according to hospital and police officials.

Witnesses said on Thursday the truck crashed into the gate of the police academy in the coastal city of Zliten, about 160km east of the capital, Tripoli.

Zliten Mayor Miftah Lahmadi told Reuters news agency the truck exploded as hundreds of recruits were gathering at the academy.

The UN Special representative to Libya, Martin Kobler, said the blast was a suicide attack.

No one has claimed responsibility for the assault.

Libyan news agency LANA, meanwhile, reported at least 50 people died. The news agency quoted the director of the town's hospital, Abdel-Motleb bin Halim, saying 127 had been wounded.

A suicide bombing today at a military training camp on the coastal road in Zliten #Libya pic.twitter.com/3BibXUPFgT — Anas El Gomati (@AGomati) January 7, 2016

Meanwhile, fires caused by clashes between fighters of the Islamic State of Iraq and the Levant (ISIL) group and security forces at Libya's biggest oil ports have spread to five oil storage tanks that were still burning.

At least nine troops were killed and more than 40 wounded in fighting around the perimeter of the area on Monday and Tuesday, said Ali al-Hassi, a spokesman for the security forces.

Libya has been sliding deeper into conflict since the 2011 uprising that ousted long-time leader Muammar Gaddafi, with rival governments and powerful militias battling for control of its main cities and oil wealth.