Police fired on the militants as they approached a checkpoint near the consulate in Jalalabad, prompting one of them to set off their explosives-laden car, said Masum Khan Hashimi, the deputy police chief of Nangarhar province.
The blast killed nine bystanders, and injured another 24 people, including a policeman.
All three attackers also died, although it was not clear how many were killed by police fire and how many by the explosion.
In New Delhi, Indian External Affairs Ministry spokesman Syed Akbaruddin said that all Indian officials in the consulate were safe.
Afghanistan’s main insurgent group, the Taliban, denied in a text message that it had carried out the attack. Smaller militant groups based in Pakistan have targeted Indian interests in Afghanistan in the past.
Mr Hashimi said the attack began when three men in a car approached the checkpoint. Two got out of the car wearing vests rigged with explosives and a police guard immediately opened fire on them. The third man then detonated a large bomb located inside the car.
In 2010, two Kabul guest houses popular among Indians were attacked, killing more than six Indians. India blamed that attack on the Pakistan-based militant group Lashkar-e-Taiba.
The Indian Embassy was bombed in 2008 and 2009, leaving 75 people dead.
The attack came as the US planned to close its embassies in the Muslim world for the weekend due to an al Qaida threat.