Abdiaziz Isak was shot "several times and he died instantly," police officer Mohamed Dalane said, close to where the lawmaker was killed in the capital's Madina district.
Yesterday, an MP was killed and another wounded in a car bombing claimed by the Al-Qaeda-linked Shebab, which threatened to assassinate all lawmakers in the internationally-backed government.
"All of them are targets of the mujahedeen fighters and they will be killed, one by one," Shebab spokesman Abdulaziz Abu Musab told AFP.
"I saw two young men running after several gunshots, one of them was carrying a pistol, the other one followed him," said witness Nure Sheikh Ali.
More From This Section
The attacks come as the government holds the third and final day of a security conference hoping to tackle continued attacks by the Shebab.
The Shebab have been driven out of fixed positions in Somalia's major towns by a UN-mandated African Union force, but still regularly launch attacks that include bombings and guerrilla-style raids.
No one immediately claimed responsibility for today's assassination, but the Shebab said they carried out yesterday's attack, which killed MP Isak Mohamed.
Recent Shebab attacks have targeted key areas of government or the security forces, in an apparent bid to discredit claims by the authorities that they are winning the war against the Islamist fighters.
In February, Shebab militants carried out a major attack against the heavily fortified presidential palace, killing officials and guards in heavy gun battles.
AU troops fighting alongside Somali government forces launched last month a fresh offensive against Shebab bases, seizing a series of towns, but with the insurgents largely fleeing in advance and escaping unscathed to strike back in guerrilla attacks.