No one apart from the attacker was hurt in the incident in the city of Bandung on Java Island, which started with a pressure cooker bomb exploding in a park before the gunbattle erupted in the office opposite.
Police said the attacker was a former terror convict from an IS-supporting network called Jamaah Ansharut Daulah (JAD), which has been blamed for a series of recent attacks in the Muslim-majority country including an assault in Jakarta last year.
After the blast at about 8:30 am (0130 GMT), the attacker fled into a building belonging to local authorities opposite the park and set it ablaze.
US brands pro-Islamic State Indonesian group "terrorists"
Police exchanged fire during an hour-long standoff with the man. He was shot in the stomach and died later in hospital.
Everyone was evacuated from the building unhurt. Police seized guns and two backpacks carried by the attacker but did not say what they contained.
National police chief Tito Karnavian said the attacker belonged to JAD and had demanded that authorities release his associates from prison.
Indonesian security forces have arrested hundreds of militants during a sustained crackdown in recent years.
"He belongs to the group JAD - it is a main supporter of ISIS," Karnavian told reporters, using a different name for IS. "He asked for his friends to be released from prison."
He said the attacker, whom he did not name, had been jailed over his involvement with militant training in Jantho in Aceh province. Jantho was the location of a notorious militant training camp, which was closed down by authorities in 2010.
Indonesian police kill three suspects after bomb found south of Jakarta
Last month the United States designated JAD a terrorist organisation, saying the network was an umbrella group for about two dozen Indonesian extremist outfits.
Last year's gun and suicide attack in the capital left four attackers and four civilians dead, and was the first assault claimed by IS in Southeast Asia.
JAD has also been blamed for a firebomb attack on a church that killed a toddler and a foiled plan to launch a Christmas-time suicide bombing.
Many recent IS-linked plots in Indonesia have been botched or foiled, with analysts saying that many of the country's militants lack the capacity to launch serious attacks.
Indonesia, the world's most populous Muslim-majority country, has long struggled with militancy. It has suffered a series of attacks in the past 15 years, including the 2002 Bali bombings that killed 202 people, mostly foreign tourists.
A sustained crackdown weakened the most dangerous networks but the emergence of IS has proved a potent new rallying cry for radicals and hundreds flocked to the Middle East to fight alongside the militants.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ