A general view shows the scene of an explosion in the Hamarweyne district of Mogadishu, Somalia. [Reuters]

A car bomb exploded on a road leading to the airport in the Somali capital Mogadishu on Wednesday, killing at least eight people, the head of the city's ambulance services said.

Mogadishu resident Mohamed Osman said the shock of the blast hit the walls and roof of a mosque he was praying in nearby.

"When I came out of the mosque, I saw several old houses collapsed, body parts on the street, hands, legs," Osman told Reuters.

"Destroyed cars, burnt Tuk tuks (rickshaws); all this mess and loss of lives in a minute, I survived."

It was not immediately clear who was responsible for the bombing.

Osman said he had seen nine bodies at the scene. Abdikadir Abdirahman, director of Aamin Ambulance service, put the death toll at eight.

"A car bomb targeted a convoy, including bulletproof cars using Avisione street, we do not who owns the convoy. We carried eight dead people from the scene," Abdirahman told Reuters.

Earlier, a Reuters photographer saw four bodies and four damaged cars and two motor rickshaws while Ahmed Nur, a shopkeeper nearby, said he had seen at least five bodies.

A paramedic was seen attending to at least one wounded person, Reuters photographs from the scene showed.

In the past, al Qaeda-linked al Shabaab group has taken responsibility for similar attacks.

The group aims to overthrow the central government and impose a strict interpretation of Islamic law. It carries out frequent gun and bomb attacks on security and government targets, but also on civilians.

It also carries out attacks against African Union peacekeeping troops.