The US said all its personnel from the consulate in the city of Herat were safe and American forces later moved into the area to secure the site.
The attack underscored the perilous security situation in Afghanistan, where US-led troops are reducing their presence ahead of a full withdrawal next year.
According to Afghan officials, the attack in Herat started with the Taliban setting off two bombs, one in an SUV and the other in an explosives-laden small van, while militants on foot opened a firefight with Afghan security forces around the compound in the city, 1,000 kilometres from Kabul.
It was not entirely clear whether any attackers managed to breach the facility, but at least two Afghans were killed and several were wounded, said an Afghan official. At least seven attackers were killed, including the two drivers of the car bombs.
Taliban spokesman Qari Yousef Ahmadi took responsibility for the attack in a phone call with The Associated Press. Around the same time, a suicide bomber detonated his truck full of explosives near government offices in eastern Paktika province after security personnel opened fire at him.
At least seven Afghan forces were wounded in the explosion, another Afghan official said. Insurgent attacks in Afghanistan are no longer concentrated in the country's south and east, but also occur with troubling frequency in the north and west, which have been the more peaceful areas in years past.
Today's assaults came on the heels of two days of celebrations as Afghans of all backgrounds welcomed their nation's first international soccer championship win.
Afghan and US officials offered slightly different accounts of what happened in Herat, differences which could not immediately be reconciled as is common in the immediate aftermath of the attacks.
According to provincial officials, the attack began around 6 am with a powerful explosion caused by the suicide car bombers, some 60 metres from the front gate of the consulate compound.
Fellow militants then engaged in a firefight with security forces in the area.
Inside Photos: Gauri Khan, Shweta Bachchan, Aishwarya Rai go glam!
Photos: Malaika Arora spotted at a salon in Bandra
Inside Photos: Malaika Arora, Kareena Kapoor Khan party with Isha Ambani
Photos: Deepika Padukone with father Prakash at Mumbai airport
Sachin Tendulkar, son Arjun join Aaditya Thackeray for cleanliness drive in Bandra