Reports from Mogadishu say the fighting broke out Thursday when government soldiers backed by African Union troops attacked insurgent-held positions.
Somali government officials say they have retaken several neighborhoods.
Somalia's transitional government holds only small parts of Mogadishu after more than three years of fighting with insurgent groups al-Shabab and Hizbul Islam.
The insurgents gained ground and moved closer to the presidential compound during an attack late last month.
Separate fighting between al-Shabab and a pro-government militia killed at least 24 people in central Somalia on Tuesday.
Al-Shabab and Hizbul Islam are trying to topple the U.N.-backed government and turn Somalia into a strict Islamic state.
The Horn of Africa nation has not had a stable central government since 1991. Fighting over the last several years has killed tens of thousands of people and displaced more than a million.
Aid groups say the country's humanitarian situation is among the worst in the world.