About 30 militants arrived at the supermarket in four pickup trucks on Sunday afternoon, the officials and witnesses said. Shoppers fled when the militants fired in the air, but an unknown number were trapped inside when the gunmen locked the doors. The militants freed the hostages after less than an hour and left the scene.
Some shoppers were slightly hurt when the militants kicked and punched them.
The witnesses said the militants shouted that they were protesting the mingling of men and women in the supermarket and demanded that female employees cover their faces, in keeping with a strict interpretation of Islamic law.
The incident happened in the late afternoon when the Zamaran supermarket, the city's largest, is usually packed with shoppers. It appeared to be intended as a show of force by the militants who have in recent months wielded significant influence in parts of the city overlooking the Arabian Sea.
Aden has been a main battlefield in the conflict between Shia rebels, known as Houthis, and allied army units against forces loyal to the internationally recognized government as well as southern separatists and other militants. After pro-government forces expelled the Houthis from Aden in July, Al-Qaeda appears to have taken advantage of the security vacuum as pro-government forces moved on to challenge the Houthis elsewhere in southern Yemen.
Security officials in the city said on Saturday that mediated talks with Al-Qaeda to persuade its fighters to surrender their weapons or move out of Aden had failed. Washington considers Al-Qaeda's Yemen branch to be the most dangerous offshoot of the terror network.
Sunday's supermarket incident followed the overnight storming of Aden's central prison by suspected Al-Qaeda gunmen who freed an individual blamed for an August attack on the compound of the city's former governor, according to security officials in Aden.
Four people were killed in the August rocket-propelled grenade attack on the former governor's compound. The former governor and other officials who were present at the time were not hurt.
All officials spoke on condition of anonymity because they were not authorized to speak to the media. The witnesses spoke on condition of anonymity because they feared reprisals.