A number of civilians were reportedly injured in the attack, which struck the Xero Nacnac training camp for army recruits.
"The suicide bomb explosion occurred at the entrance and five new recruits died in the blast; more than 10 others were wounded," military officer Mohamed Abdullahi told AFP.
The blast comes after a week of intensive security operations to clamp down on terrorism in Somalia after Al Shabab carried out a double car bombing at the education ministry, killing more 116 people.
Security forces say 100 members of the group have been killed in recent operations, part of a continuing, 15-year struggle against the militants.
The Al Qaeda-linked fighters rose to prominence during Somalia’s most recent war with Ethiopia between 2006 and 2009, a conflict linked to internal power struggles within Somalia.
Taking advantage of a chaotic struggle that displaced millions of Somalis, the group launched suicide attacks against government targets and African Union peacekeepers.
They have recently stepped up their attacks since President Hassan Sheikh Mohamud took office in May and vowed an "all-out war" against the militants.
Last week’s attack took place at the same junction where a lorry packed with explosives blew up on October 14, 2017, killing 512 people and injuring more than 290, the deadliest attack in Somalia.
In August, the group launched a 30-hour gun and bomb attack on the popular Hayat Hotel in Mogadishu, killing 21 people and wounding 117.
The insurgents, who have been seeking to overthrow the fragile foreign-backed government in Mogadishu, were driven out of the capital in 2011 by an African Union force.
But the group still controls parts of the countryside and continues to wage deadly strikes on civilian, political and military targets.