The fire began just after midnight on Sunday evening, media reported, with videos shared on social media showing huge flames engulfing the refinery, while a large explosion can be heard.
Pertamina said in a statement the fire at the refinery, which can process 125,000 barrels per day, broke out during bad weather.
"The cause of the fire is unknown, but during the incident there was heavy rain and lightning," Pertamina said.
Ifki Sukarya, a Pertamina spokesman, later said five people were being treated in hospital for burns, adding that some were passing near the refinery when the fire broke out.
Television footage showed the fire still raging on Monday morning and a massive column of black smoke rising from the site, which is about 225 km (140 miles) east of the capital Jakarta.
One 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.
The state oil firm said it was shutting down the refinery and conducting "oil flow control" to prevent any further spread.