File picture: Xinhua/Faisal Isse

Mogadishu - At least 18 people were killed and 20 wounded on Friday when two car bombs exploded in the Somali capital of Mogadishu, the city's main ambulance service said.

Jihadist rebels claimed the attack.

"We have so far collected 18 bodies and 20 wounded persons from one of the blast scenes," Abdukadir Abdurahman Aden of the Aamin Ambulance told AFP.

The bombings targeted the presidential palace and a city hotel, police said.

The first blast, followed by gunfire, occurred at a checkpoint close to Villa Somalia, the name for the seat of government, while a second followed soon after at a hotel.

"I can confirm an attack in the vicinity of the presidential palace," said police officer Ibrahim Mohamed.

"Another car loaded with explosives went off close to a recently opened hotel," Mohamed added.

The Islamist militant group the Shabaab, claimed the attacks in a statement posted online, saying it was targeting the government and security services.

The blasts follow weeks of relative calm in Mogadishu.

The Shabaab is fighting to overthrow Somalia's internationally-backed government. In October it carried out its deadliest-ever bombing, killing over 500 people.

In the wake of that attack Somalia's government declared a fresh offensive against the group and US drone strikes have increased in tempo.

While the militant group was pushed out of the capital in 2011 by an African Union force it continues to control large parts of the countryside and launch regular attacks on government, military and civilian targets.