National police spokesman Setyo Wasisto said the men attacked officers after driving a minivan into the police compound in Pekanbaru.
Police officer killedThe incident also left an officer dead and two others wounded.
A fifth man, who drove the vehicle, was arrested trying to escape, Wasisto said, while a man hunt has been launched for a sixth suspect.
Read more: How Indonesian women are lured to jihad
Earlier, an internal police report said that one of the dead men may have had a bomb strapped to his body.
The "Islamic State" (IS) group, which is supported by as many as 30 Indonesian militant groups, quickly claimed responsibility for Wednesday's assault through its Amaq news agency.
Attacks stepped upThe attack comes after a series of suicide bombings, also claimed by IS, which targeted churches and a police building in Surabaya — Indonesia's second-biggest city, over the past few days.
The suicide bombings, involving families with young children, and an explosion at an apartment where militants were thought to have been building bombs have left around 30 people dead, including 13 suspected perpetrators, police said.
This week's attacks are the worst in the world's biggest Muslim-majority country since the bombing of tourist-packed restaurants in Bali in 2005.
Read more: Investigation of Jakarta governor fuels fears of rising Islamism in Indonesia
Militants gaining confidenceEarlier this month, six officers at a high-security detention center on the outskirts of the capital, Jakarta, were killed by jihadi inmates who took control of part of the prison and held hostages until being overwhelmed by police.
After some major successes tackling Islamist militancy, Indonesia has seen a resurgence in recent years, including in January 2016, when four suicide bombers and gunmen attacked a shopping area in the capital, Jakarta.
The bloody violence is putting pressure on Indonesia's parliament to pass a stalled security law that would give police more power to take pre-emptive action against terror suspects.
mm/aw (AFP, AP, dpa, Reuters)