“We have confirmed eight people killed and 16 others wounded in the blast,” the private Aamin Ambulance service told AFP news agency on Saturday.
The first car bomb, which exploded near a checkpoint for the presidential palace, was responsible for the eight deaths while no casualties were reported after the second car bomb, at a checkpoint on the road to the airport.
Another 25 people were wounded, General Bashir Abdi Mohamed told reporters in Mogadishu.
Al-Shabab, which often targets the capital, said the blasts were meant to strike the first line of security checkpoints for the airport and palace.
The airport is home to a number of diplomatic offices and the palace is a frequent al-Shabab target.
“I was at a short distance from the blast and I saw several people dead, including two women, a passenger and two men, some of whom were elderly,” witness Hussein Mohamed told the Associated Press news agency.
“This is really very terrible.”
Earlier on Saturday, police said a militia executed nine civilians in retribution for al-Shabab killing a policeman.
The revenge attack on Friday just outside Galkayo – one of the most developed cities in the centre of the country – targeted the Rahanweyn clan, several of whose members are suspected of being al-Shabab fighters.
“This was a horrible incident, a gruesome killing against nine unarmed innocent civilians in southern Galkayo,” a policeman, Mohamed Abdirahman, said.
“All of the civilians belong to one clan and the gunmen shot them dead in one location a few minutes after suspected Shabab gunmen killed.”
Witnesses told local media the victims were rounded up from the streets or their homes and shot dead on the outskirts of Galkayo, which is about 600 kilometres north of Mogadishu.
Separately, 10 Kenyan police officers were killed on Saturday when their vehicle ran over a landmine during a patrol near the border with Somalia.
Al-Shabab was responsible for a horrific truck bombing in Mogadishu in October 2017 that killed more than 500 people.
The armed group has been fighting since 2007 to topple Somalia’s fragile government, which is backed by a 20,000-strong African Union force, AMISOM.
Al-Shabab fighters fled fixed positions they once held in Mogadishu in 2011, and have since lost many of their strongholds.
But they retain control of large rural swaths of the country and continue to wage a guerrilla war against the authorities.
The group has carried out a number of attacks in Kenya since 2011 in reprisal for the country’s participation in AMISOM.