Gunmen sprayed the car of MP Mohamed Ahmed Gurhan with bullets as he travelled through the capital Mogadishu on the way to parliament, fellow lawmaker Dahir Amin Jesow said.
"He was attacked by gunmen who were driving in a car, and they have shot him several times," Jesow said. Gurhan later died in hospital as a result of the wounds.
No one immediately claimed responsibility for the attack, but it is the latest in series of shootings targeting MPs, with al-Qaeda-linked Shebaab insurgents having claimed previous killings.
"The gunmen escaped in a car after opening fire... They also shot to scatter the crowds," said Abdifatah Suleiman, an eyewitness.
The Shebaab is fighting to overthrow Somalia's Western-backed government, which is propped up and protected by the 22 000-strong African Union force (AMISOM).