A hotel in Somalia's capital has been hit by an explosion and an attack by jihadist rebels, police have confirmed.

A vehicle loaded with explosives crashed into the entrance gate of the Afrik hotel, near Mogadishu's strategic K-4 junction, on Sunday afternoon, police spokesman Sadiq Adan Ali said.

A number of armed gunmen then quickly invaded the hotel, opening fire on staff and patrons inside, he said. Government forces responded to the attack and gunfire could be heard coming from the hotel. Police rescued many people from the hotel, including its owner and an army general.

At least seven wounded civilians could be seen although police did not immediately give casualty figures.

DOCUMENTARY ALLEGING OPULENT PUTIN PALACE GETS 100M VIEWS

Al-Shabab, Somalia's homegrown jihadist rebels, claimed responsibility for the attack through their Andalus radio station.

Hundreds of newly trained al-Shabab fighters perform military exercises near Mogadishu, in Somalia, in 2011.

Hundreds of newly trained al-Shabab fighters perform military exercises near Mogadishu, in Somalia, in 2011. (AP)

"We know, they have changed nothing from their usual tactic, ramming explosives into a building and following up, assaulting with rifles," said Ali.

CLICK HERE FOR THE FOX NEWS APP

In a separate incident, at least eight children have died and scores of others were wounded when a bomb went off in the Golweyn area, about 40 kilometers (25 miles) north of the coastal town of Merca, some 120 kilometers (74 miles) south of Mogadishu.