Assailants stabbed a Japanese diplomat repeatedly Sunday after dragging him from his car in the Yemeni capital, scene of a spate of attacks on foreigners, the embassy and witnesses said.
The consul and second secretary at the embassy suffered five stab wounds in the morning attack in the Hadda neighbourhood, an embassy spokesman said.
"He is in a stable condition," a diplomat said on Sunday afternoon, while a medical source said "he needs to be hospital for few days to recover."
The embassy spokesman declined to disclose the name of the consul.
It was unclear if the attack was an attempted kidnapping.
The spokesman said he had been driving ahead of the consul, who was no longer behind him when he arrived at the embassy.
The diplomats had been driving without guards, he added.
Witnesses said six masked men attacked the diplomat in a small street, about 250 metres (820 feet) away from the Japanese mission.
They pulled him out of his car and one of the assailants hit him on the head with a pistol butt, before pushing him to the ground and driving off in his vehicle.
Local residents said they administered first aid in a nearby shop, until an embassy vehicle arrived and took him away.
An AFP correspondent found traces of blood in the street.
Signup to our newsletter and follow us on Facebook and Twitter!
Security forces deployed around the hospital and set up checkpoints.
Foreigners are frequently attacked or kidnapped in Yemen, home to Al-Qaeda in the Arabian Peninsula which is viewed by the United States as the network's deadliest franchise.
But armed tribesmen also kidnap foreigners to use as bargaining chips to gain government concessions.
A Dutch couple was set free last week after spending six months in captivity.
In late November, unidentified gunmen killed a Belarussian defence contractor and wounded another in an attack outside their hotel in Sanaa.
And a German embassy guard was killed in October as he resisted an attempt to kidnap him.
Hit-and-run assassinations are frequent in Yemen and are mostly blamed on Al-Qaeda militants, or stem from tribal disputes.
The United Nations closed its offices in Sanaa on Thursday over fears of possible car bombs attacks, and the American and Turkish schools were shut, but Western embassies remained opened.
The alert came after a brazen daylight attack on the defence ministry complex in Sanaa on December 5 that killed 56 people, among them expatriate medical staff.
In August, a security alert originating in Yemen prompted an unprecedented closure of American embassies across and beyond the Middle East.
Yemen has been battling through a tough political transition since veteran president Ali Abdullah Saleh was ousted from power in February 2012, following a year of deadly protests against his 33-year rule.
The transition aims to culminate in a new constitution and pave the way for parliamentary and presidential elections in February 2014, but faces many hurdles.