A huge explosion at an oil refinery in Indonesia has left at least five people have been injured and forced hundreds to evacuate.

Indonesian state oil company Pertamina said on Monday the Balongan oil refinery in West Java was shut as firefighters battle to control the inferno.

About 950 nearby residents had been evacuated, Pertamina said, with images on social media showing huge flames engulfing the 125,000 barrels per day facility.

A large explosion was also heard.

The fire started just after midnight, local media reported, while Pertamina said in a statement it broke out during bad weather.

It was conducting "oil flow control" to prevent any further spread.

Onlookers watch the burning oil refinery on Monday
Onlookers watch the burning oil refinery on Monday

"The cause of the fire is unknown, but during the incident there was heavy rain and lightning," it said.

Pertamina spokesman Ifki Sukarya said five people were being treated in hospital for burns, adding that some were passing near the refinery when the fire broke out.

No Pertamina staff were hurt, he said.

The fire was concentrated in the refinery's storage units, and there had been no impact on the processing plant, Pertamina said.

Footage of the blaze showed the fire still raging on Monday morning and a massive column of black smoke rising from the site, which is about 225 km east of the capital Jakarta.

Smoke rises during fire at Pertamina's oil refinery in Balongan
The refinery is about 225km away from the country's capital Jakarta
Smoke rises during fire at Pertamina's oil refinery in Balongan
Nearly 1,000 people living nearby have been evacuated

West Java police will be involved in the investigation into the cause of the fire, police spokesman Erdi Chaniago told Reuters.

"We are securing the location at the moment, since the fire is still going. We can't examine the scene yet, cooling down needed to be conducted first by Pertamina," he said.

A nearby resident told Metro TV she was awoken by a pungent smell of oil fumes and saw lightning strikes in the sky.

"We smelled a strong fuel scent first, so strong that my nose hurt, while we heard lightning strikes," said Susi, who gave only one name.

"Suddenly the sky was orange," she said.

Balongan, one of Pertamina's biggest refineries, processes crude oil from the Duri and Minas fields in Riau province and supplies fuel to Jakarta and the western regions of Java island.