Gunmen entered the general finance directorate in Jalalabad, capital of Nangarhar province bordering Pakistan, said Attaullah Khogyani, spokesman for the provincial governor.
He also added that the attack left at least forty two people wounded, including civilians, Customs Department workers, and security personnel.
According to a member of the provincial council, the encounter between at least four attackers, armed with rocket propelled grenades and machineguns and security forces is still going on. More explosions were then heard coming from inside the building, he added.
Militants have staged several attacks across Afghanistan this year.
April saw a series of attacks across the country targeting voter registration centres as Afghanistan gears up for long-delayed legislative elections due in October.
Daesh claimed responsibility for the attack, in a busy area of the city with many other official buildings nearby, including a school in which about 1,000 girls were trapped as the fighting raged.
The Taliban recently launched their annual spring offensive, in an apparent rejection of a peace overture by the Afghan government.
Nine journalists, including AFP's chief photographer in Kabul Shah Marai, were among 25 people killed in a double suicide blast claimed by IS in the capital on April 30.
There were multiple blasts as they fought off security forces in a gun battle that lasted much of the day.