The building targeted is located in the supposedly tightly secured coastal district of Tawahi that hosts intelligence and political police headquarters, a naval base and a presidential residence.
"We have regained control of the situation," an army official told AFP, adding that the fighting went on for several hours.
Ten of the assailants were killed, along with a suicide bomber who detonated his explosives-laden car at an entrance to the base, the official said.
The militants launched the attack on the northern side of the army headquarters, with some of them climbing a wall into the building as a car was blown up at a western entrance, the sources said.
Also Read
Reinforcements from the 31st Armoured Brigade stationed in Aden were dispatched to support the troops in Tawahi, a military official said.
No information was immediately available on the overall number of attackers.
The official Saba news agency quoted a security official as saying the incident was "a suicide terrorist attack by Al-Qaeda".
The brazen attack on such a highly protected area came despite the authorities having stepped up measures in recent weeks to contain a deadly wave of violence rocking the Arabian Peninsula country for years.
On March 8, President Abdrabuh Mansur Hadi replaced interior minister Abdelqader Qahtan for failing to improve the "below-par" performance of the security forces.
Qahtan's successor, Abdo Tareb, ordered the dismissal of three security chiefs for failing to prevent a March 24 attack attributed to Al-Qaeda on an army checkpoint in the southeastern Hadramawt province, in which 20 soldiers were killed.