Mohamud, 66, defeated incumbent President Mohamed Abdullahi Mohamed in a run-off after three rounds of voting throughout Sunday.
Supporters greeted the result by cheering and firing guns into the air around the capital Mogadishu
Mohamud faces a daunting task in the Horn of Africa nation of 15 million people, which is suffering drought, hunger and seemingly never-ending conflict.
Earlier, blasts from mortar shells rang out near Mogadishu airport where the parliamentarians were meeting, residents said.
There was no claim of responsibility and the explosions did not disrupt the vote, but Somalis are used to attacks on state institutions from al Shabaab militants.
The United Nations-backed vote was delayed by more than a year due to squabbling in government, but had to be held this month to ensure a $US400 million ($A576 million) International Monetary Fund program.
It took place during Somalia's worst drought in four decades, and against a depressingly familiar background of al-Shabaab violence, infighting among security forces and clan rivalries.
Somalia has endured civil war, insurgency and clan battles with no strong central government since dictator Mohamed Siad Barre was toppled in 1991.
Though just holding the process was a success of sorts, many Somalis were sceptical of any real improvement for them.
Leading candidates were old faces recycled from the past who had done little to stem conflict and corruption, they complained.
Votes are traditionally dominated by bribery, Somalis say.
Somalia is still unable to hold a direct vote due to insecurity, with the government having little control beyond the capital and peacekeepers guarding an Iraq-style "Green Zone".