Fighting erupted in the city's Medina area between gunmen loyal to Muse Sudi Yalahow, widely regarded as Mogadishu's most powerful warlord, and others backing his former militia commander Omar Mohamed Mohamud.
It began at about 10:30 a.m. (0730 GMT) and was still going on by mid-afternoon. Many people fled the area.
Violence between two other rival militia factions broke out in another part of the city.
It was not immediately clear what triggered the fighting.
Somalia has been torn apart by fighting since 1991, when military ruler Mohammed Siad Barre was overthrown and the country descended into chaos.
A transitional government sits in Mogadishu but controls only parts of the capital and small pockets of the rest of the country. Other areas are controlled by rival warlords.
Peace talks are under way in neighbouring Kenya, but have struggled to make any progress. On Tuesday the transitional government, one of many factions taking part in the talks, said it was pulling out because the peace process was on the verge of collapse.
- Reuters - Thomson Reuters Foundation
- For more humanitarian news and analysis, please visit https://www.trust.org/alertnet