The attacks in the western Afghan city near the border with Iran began about 6 a.m. local time Friday, and included a gunfight between militants and security forces.
The Taliban told the BBC a suicide bomber set off explosives outside the building. An Afghan military spokesman told the BBC the initial explosion damaged the outer defenses of the U.S. consulate and that the attackers later breached the perimeter and opened fire.
CNN quoted U.S. State Department spokeswoman Marie Harf as saying a truck carrying the attackers sped toward the front gate of the consulate and its occupants began firing with assault rifles, which led to a gun battle with Afghan security forces.
Harf said the truck exploded, causing major damage to the front gate of the consulate, forcing consulate personnel to take shelter inside while U.S. security forces also responded to the attack. She said there were no U.S. casualties.
"Full details are not known of the extent of the attack at this point, but the attack is currently over," Harf said.
CNN, quoting a hospital spokesman, said nine injured people were taken to his facility in Herat.
China's official Xinhua News Agency, quoting a local security force, reported at least three people died in the incident and another 10 were injured.
"Many Afghan civilians were killed in the attack, along with others who work for the Consulate as contractors," said U.S. Ambassador to Afghanistan James B. Cunningham. "We are deeply saddened by this senseless loss of life."
Taliban violence has escalated sharply in recent weeks as U.S-led NATO forces have begun preparations to end combat operations in Afghanistan, which are expected to be completed by the end of next year. Afghanistan's security forces have already been given responsibility for the nation's security.
An attack this month, allegedly by Taliban forces, targeted the U.S. base at the Torkham border crossing to Pakistan in eastern Afghanistan. Three of the attackers were killed in a gun battle.
Afghan President Hamid Karzai and his delegation were in Kyrgyzstan Friday to attend the Shanghai Cooperation Organization Summit. Karzai was scheduled to meet with presidents of Russia, Kyrgyzstan, China and Iran to discuss regional cooperation against terrorism and other regional issues.