"The explosive device was planted under a pile of rubbish near a police post," police officer Abdi Bare told AFP.
"Two people are confirmed killed and seven others, mainly civilians, were wounded," he added.
There was no immediate claim of responsibility, but Somalia's Al-Qaeda linked Shebab have carried out a string of similar bombings, and have vowed to increase attacks during the fasting month of Ramadan.
The roadside bomb ripped through Mogadishu's Karan market, in the north of the capital, where people were busy buying food to celebrate the breaking of the fast with their families at sunset.
More From This Section
Last week the Shebab commander in Mogadishu Sheikh Ali Mohamed Hussein warned attacks would increase with the capital becoming the "frontline" for assaults.
"Mujahedeen fighters will intensify strikes on the enemy," Hussein said in a radio broadcast Sunday.
Shebab fighters fled fixed positions in Mogadishu three years ago and have since lost most large towns to a 22,000-strong UN-backed African Union force, fighting alongside government soldiers. However, the extremist fighters still regularly launch guerrilla raids.
Last week Shebab commandos attacked an AU military base in central Somalia dressed in stolen government army uniforms, killing at least two soldiers from Djibouti.
But the Islamists also threaten other countries in the region, especially those contributing troops to the AU force, including Burundi, Djibouti, Ethiopia, Kenya and Uganda.