The Al-Qaeda-linked militia claimed responsibility for the raid against the complex, which also houses a major detention facility, saying it was being used for the "torture and humiliation" of "innocent Muslims".
The coordinated attack also came a day after Somalia's national army and African Union forces said they had captured a Shebab stronghold as part of a joint offensive aimed at seizing key ports and cutting off a key source of revenue for the Islamist rebels.
"There were seven attackers. One of them blew himself in the car while the six others were killed by the security forces," interior ministry spokesman Mohamed Yusuf told reporters, adding that three members of the security forces and a civilian were also killed.
"The attack is over now and the attackers have failed to achieve their goal aimed at interrupting the Indian Ocean operation," he said, referring to the current AU and government ground offensive.
Also Read
"Our courageous Mujahideen in Mogadishu succeeded in attacking the notorious Jila'ow prison, controlled by the apostate intelligence services. For a long time innocent Muslims suffered in the dungeons of that prison while being subjected to torture and humiliation," he said in a statement.
The Jilicow intelligence facility and detention facility is located close the Villa Somalia, the complex that houses the office of Somalia's internationally-backed President Hassan Sheikh Mohamud.
The Villa Somalia was hit by a similar attack in July, when a car bomb was detonated and Shebab fighters stormed the complex before blowing themselves up.
Shebab rebels have continued to target key areas of government or the security forces, in an apparent bid to discredit claims by the authorities - who are backed by the African Union's 22,000-strong AMISOM force - that they are winning the war against the Islamist fighters.