Indonesian state oil company Pertamina and Chinese giant PetroChina are joint operators of the well.
Officials from the two companies told Reuters the fire was put out on Saturday and did not impact on production.
Local police chief Rumhadi told Reuters that “residents saw a big fire ball in the sky with a thunderous sound”.
An official from Indonesian oil and gas regulator BPMIGAS said the situation was quickly brought under control.
“There was a blow-out when conducting development well. There is no impact to the oil production. The well is under control.”
Senior health ministry official Rustam Pakaya told Reuters 2600 people were evacuated while 12,000 were close enough to the explosion to suffer potential health problems from the fumes.
Pertamina director Ari Sumarno said initial concerns centred on the presence of hydrogen sulphide gas. He added that water and mud were later used to put out the fire.
In May, a well control incident at the Banjar Panji-1 exploration well in Java resulted in massive amounts of toxic mud spewing to the surface.
Indonesian company Lapindo Barintas operates the well, in which Australian oil and gas major Santos holds an 18% stake.
Global experts in well control incidents have flown to the scene but have so far been unable to stem the mudflow, which has caused thousands of people to be relocated after the mud enveloped their homes.