The assailant shot the cameraman in the back at close range, killing him on the spot before disappearing in the crowd, an Associated Press reporter who witnessed the shooting said.
Another Western reporter who was walking with the victim was unhurt.
In Stockholm, the Swedish Foreign Ministry identified the man as Martin Adler.
After years without any government or police, Mogadishu has become one of the most dangerous cities in the world. Assault rifles and pistols are commonplace and disputes are settled either through revenge attacks or through clan-based Islamic courts.
Anti-foreigner sentiment has reached new heights after reports that widely despised warlords were financed by the CIA to capture suspected al-Qaida members in Somalia.
Mr Adler was a well-respected journalist who won many international awards, including the 2001 Amnesty International Media Award, a Silver Prize for investigative journalism at the 2001 New York Film Festival and the 2004 Rory Peck Award for Channel Four’s Hard News. He worked in more than two dozen war zones, including Iraq, Afghanistan, Bosnia and Rwanda.
Mr Adler was born in Stockholm and lived there with his wife and two children.
The killing occurred a day after Somalia’s largely powerless UN-backed government and a representative of the Islamic group controlling Mogadishu signed an agreement in neighbouring Sudan that calls for an immediate ceasefire and confers militia recognition on the interim administration.