At around 2 a.m. militants attacked the police headquarters in Dih Bala district of Nangarhar province, said Attahullah Khogyani, a spokesman for the provincial governor.
Five police officers, including the district police chief, were killed and six wounded, he said. At least 13 militants were killed and 7 wounded, Khogyani said.
Islamic State's Khorasan Province branch claimed responsibility for the attack in a statement online and said it killed the police chief and 13 officers.
Nangarhar, a volatile province that borders Pakistan, is where militants claiming allegiance to Islamic State have made their greatest inroads in Afghanistan.
Earlier this year American forces were given the green light to conduct more air strikes against Islamic State in Afghanistan, wading into a fight being waged by Afghan troops and Taliban insurgents competing for influence in the area.