The incident took place in the central town of Bent Bayya, according to the Health Ministry in the capital of Tripoli.
The ministry did not say how many were killed, but Foreign Minister Najla Mangoush said on Twitter that the incident left at least five dead.
The state-run Libyan News agency said the tanker truck overturned before catching fire and exploding. It said residents in the area rushed to collect leaked gasoline despite warnings.
The state-run medical center in the nearby city of Sabha received at least 50 injured people, Halima al-Mahri, a spokeswoman for the center. She urged authorities to help evacuate the injured to the capital of Tripoli for treatment.
The center posted footage, including graphic images, of people at an emergency ward receiving treatment for their burn injuries.
It was not immediately clear what caused the tanker to overturn and explode. Fathi Bashagha, one of Libya’s rival prime ministers, said he ordered an investigation into the incident.