US State Department deputy spokeswoman Marie Harf said there were no American casualties in the attack and the US embassy in Kabul confirmed on Twitter that all consulate staff were safe and accounted for.
Herat, in western Afghanistan near the Iranian border, is considered one of the least volatile cities in Afghanistan, where the Taliban are fighting a 12-year insurgency.
The front gate of the US consulate was "extensively" damaged, Harf told reporters.
An AFP reporter at the scene said one vehicle had been completely destroyed. Four Afghan policemen were among the wounded, Herat hospital spokesman Mohammad Rafiq Sherzai said.
More From This Section
The US State Department said the attack started at 5:30 am when the gunmen, dressed in suicide vests, drove up to the front gate in a truck, opened fire and then detonated the truck bomb.
American and contracted security personnel reacted to the attack but the assault is over, Harf said.
"It appears American and contract security personnel addressed any attackers who managed to enter the compound," she added, giving no further details.