The 275 Somali MPs and 72 senators are electing this Wednesday a new president after several postponements since last year.
There are 23 candidates in the race for the top political executive position, including incumbent President Hassan Sheikh Mohamud.
Somalia has not had an effective central government since 1991 when the regime of Siad Barre ended. Barre ruled between 1969 and 1991.
The capital has been under a partial curfew ahead of the vote.
The government dropped an initial plan to give each adult a vote owing to challenges in securing national polling stations. Instead, about 14,000 clan elders and regional figures chose the 329 lawmakers.
The candidates have been making speeches before the members of parliament to explain their plans for the future of Somalia. Most criticized the current president, accusing him of failing to stop al-Shabab attacks or to stabilize the country.
Al Shabaab insurgents have long threatened to scuttle the process they are opposed to, arguing they do not believe in the democratic process.
Al-Shabab, which is affiliated with al-Qaeda, has waged an insurgency in the Horn of Africa nation since 2006 in a bid to impose its version of Islamic law. While the group was driven out of Mogadishu in 2011 by government and African Union forces, it continues to stage deadly gun and bomb attacks.