Indonesia has the world's largest Muslim population and has been on high alert over a recent resurgence in radicalism inspired by the extremist group Islamic State.
After a police chase the six abandoned their vehicle in a village in the Tuban area, not far from the industrial city of Surabaya, and attempted to flee into a plantation where they were all killed in a second gun battle with police, East Java Police spokesman Frans Barung Mangera said.
"By around 5pm we had immobilized all of them," Mangera said, confirming that all six had died during the incident. A box of 9mm bullets was found in their vehicle, he said.
Police were monitoring the vehicle prior to the attack, he said, in connection with the Friday arrest of three suspected members of the group, Jemaah Anshorut Daulah (JAD), who were allegedly planning an attack on a police station and had bought M16 machine guns from the southern Philippines.
"We tried to stop that vehicle, but the vehicle did not stop," Mangera said, adding that those in the vehicle "took out weapons and shot at officers."
Indonesia has had some major successes tackling militancy inspired by al Qaeda's attacks on the United States in 2001. But there has been a resurgence of Islamist activity in recent years, some of it linked to the rise of Islamic State.
The most serious incident last year was in January when four suicide bombers and gunmen attacked a shopping area in central Jakarta.
Jemaah Anshorut Daulah is an umbrella organization on a U.S. State Department "terrorist" list that is estimated to have drawn hundreds of Islamic State sympathizers in Indonesia.
Recent attacks by Islamic State sympathizers have mostly been poorly organized, but authorities believe about 400 Indonesians have left to join the militant group in Syria, and some could pose a more deadly threat if they came home.
(Reporting by Agustinus Beo Da Costa; Writing by Fergus Jensen; Editing by Hugh Lawson)