The gunmen travelling in a 4x4 vehicle attempted to stop the diplomat's car in the Hadda district of Sanaa, which is home to many embassies, the official told AFP.
The diplomat was wounded when the gunmen opened fire as he sped away.
The official did not specify the nationality of the diplomat but the attack happened not far from the German embassy.
Last October, a German embassy security guard was killed as he resisted a kidnapping attempt.
Nearly all have later been freed unharmed.
But in recent years there has been a growing number of abductions by Al-Qaeda loyalists, several of whose hostages remain in captivity.