Two gunmen who stormed the building killed three policemen, a civilian and a child, the spokesman for Herat provincial governor, Jailani Farhad, said, adding that four policemen were also wounded before the attackers were killed.
Members of the Afghan National Security Forces seized a vehicle packed with explosives from the attack site.
No militant group claimed responsibility for the assault, launched two days after Taliban fighters launched a series of attacks on checkpoints in four Afghan provinces, killing 32 members of the security forces and pro-government militias.
The Taliban has inflicted a heavy toll on government forces this winter, while the US military with their government allies have killed Taliban field commanders with air strikes.