The German foreign ministry confirmed that an embassy vehicle came under fire, adding that all passengers were "safe."
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 said, adding that the diplomat was wounded as he sped away.
"Unknown people opened fire today in Sanaa at a vehicle belonging to the German embassy. The passengers are currently safe," a ministry spokesman said.
Last October, a German embassy security guard was killed as he resisted a kidnapping attempt.
More From This Section
Two Britons and a German were kidnapped in January and February respectively.
Hundreds of people have been kidnapped in Yemen over the past 15 years, mostly by tribesmen who use them as bargaining chips in disputes with the government.
Nearly all have later been freed unharmed.
But in recent years there has been a growing number of abductions by Al-Qaeda militants, several of whose hostages remain in captivity.
Iranian diplomat Nour-Ahmad Nikbakht, kidnapped in July 2013 from Sanaa, is also held by Al-Qaeda captors.