The 56-year-old academic promised to bring Somalia, best known as a byword for failed state, back into the international fold, but he inherits an ongoing war, a humanitarian crisis, feeble institutions and deeply entrenched warlordism.
The embattled government's Western backers praised the vote as a milestone in the restoration of peace, but the Al-Qaeda-linked Shebab rebels who still control vast swathes of the country promptly dismissed it as illegitimate.
"I promise that Somalia reclaims its place in the world community as of today -- and to do that, we must ensure that we move forward," Hassan was quoted as saying in a statement Tuesday.
The respected lecturer and peace activist faces the daunting task of putting together a credible government after more than a decade of transitional administrations seen as corrupt and toothless.
UN leader Ban Ki-moon congratulated Mohamud but urged him to "move expeditiously, to appoint an inclusive, accountable government that can begin the work of peacebuilding in the country," a spokesman said in a statement.
EU foreign policy chief Catherine Ashton called Hassan to tell him he had "a strong mandate to establish a new government that can rebuild the country".
British Prime Minister David Cameron, who has sought to take a leading role in Somalia's peace efforts in recent months, described the election as "a significant moment" for the Horn of Africa nation.
"Somalia's leaders must now work together to build a more representative and transparent system, tackle corruption and strengthen security and stability," he said in a statement.
The outgoing president, Sharif Sheikh Ahmed, had been confident of reelection before Monday's vote and few had predicted Hassan would even be among the main contenders.
As a former top leader in the Islamic Courts Union that overran the country in 2006 and gave birth to the Shebab group, Sharif's election in January 2009 was seen then as Somalia's best chance in years to end the conflict.
Hardline Islamists always considered him a traitor however and Western powers were reluctant to negotiate with a terror-listed group, but analysts suggested the new president might be in a better position to broker truly inclusive talks.
"For there to be lasting peace... Shebab needs to be incorporated into future dialogue," Ahmed Soliman, Horn of Africa researcher at the London-based think tank Chatham House, told AFP.
"If Hassan Sheikh Mohamud is able to maintain good links with the Shebab and bring them to the table for dialogue that would be a positive step," he said.
Hassan, a member of the dominant Hawiye clan, has links to the Somali branch of the Muslim Brotherhood, a movement which has been achieving huge political gains on the back of the Arab Spring and has generous backing from Gulf states.
The Shebab, which has proclaimed its allegiance to Al-Qaeda and waged a deadly campaign against the government and foreign troops in Somalia, dismissed the election process but appeared to spare Hassan himself.
"Nothing personal, but the whole process is like an enemy project," spokesman Sheikh Ali Mohamud Rage told AFP Tuesday.
Around 20,000 troops from Ethiopia, Uganda, Burundi, Djibouti and Kenya are currently battling the Shebab in Somalia.
An African Union-led military drive has reclaimed control of most of Mogadishu, but the country's second city and key port of Kismayo remains under insurgent control.
J. Peter Pham of the Washington-based Atlantic Council warned Hassan had no real power base and would be presiding over "an entity more known for stealing foreign aid than using it for the good of the Somali people."
Among some of the most pressing issues the new president will have to address is a humanitarian situation which the United Nations has often described as the worst in the world.
The UN Office for the Coordination of Humanitarian Affairs said Tuesday that the number of people needing food aid in Somalia had dropped 16 percent in half a year but still stood at a staggering 2.1 million.