The fight, which took place in the same western zone of Rio where the Olympic Park and the Athletes' Village are located, was the latest high profile crime in the city where 85,000 police and soldiers have been deployed to keep the peace during the Games.
The vice consul, who was not identified by police, "reacted to an attempted assault," a statement from the homicide department said yesterday.
"The vice consul got into a physical struggle with the assailant and during the fight the aggressor's weapon fired shots. The assailant died of his wounds on the spot."
He was in his car with his wife and daughter in a car when they were ambushed by men on two motorbikes while caught in a traffic jam, the report said. The second robber fled, according to the report.
Traffic jams are a favored target for robbers on foot or on motorbikes in Rio, as well as buses which are regularly raided by armed men.