National police spokesman Martinus Sitompul said the men were cornered in a village of Tuban district after attempting a drive-by shooting of a police officer who was patrolling a busy road in the area.
He said the six had refused appeals to surrender during a standoff that lasted several hours, and sparked the gun-battle with mobile brigade and counter-terrorism police by throwing explosives.
The previous day, counter-terrorism police arrested three suspected militants who were planning to attack a police station in East Java.
Sitompul said police are investigating whether the six men were part of Jemaah Anshorut Daulah, an umbrella group of Indonesian extremists that was formed in 2015 and claims allegiance to IS.
Police said they seized dozens of rounds of ammunition, several firearms, knives, jihadi books and a car used by the men.