Saturday's election represents a chance for the coup-plagued desert nation, which straddles the Arab and African worlds, to end decades of military rule and resurrect (b) billions of US dollars in frozen aid once pledged by international donors.
But in a country where military strongmen wield more power and influence than the constitution or any written law, neither task will be easy.
The vote began on Saturday after police in Nouakchott exchanged fire overnight with two alleged members of an al-Qaida-linked cell that claimed responsibility for gunning down an American teacher here last month.
State security chief Mohamed Lemine Ould Ahmed said both men were detained; one, found wearing an explosive belt around his waist, was shot and wounded by police.
The US has expressed concern over the steady spread south from Algeria in recent years of al-Qaida's North Africa branch.
While Washington never recognised Mohamed Ould Abdel Aziz's junta, it is keen to maintain Mauritania as a bulwark against the group and prevent the moderate Muslim nation from sliding toward extremism.
Vote counting began after polling stations began closing around 7 p.m. (1900GMT).
Hundreds of international observers are monitoring Saturday's poll, and most expect it to be free and fair.
If no candidate wins the necessary 50 percent majority, a second round will be held August 1.
Of the nine candidates contesting, three others are considered serious contenders: veteran opposition leader Ahmed Ould Daddah, who was runner-up in 2007, Colonel Ely Ould Mohamed Vall, who led the 2005 junta, and parliament speaker Messaoud Ould Boulkheir, a black Moor whose parents were slaves in an era before the practice was outlawed.
All three men are promising to put Mauritania back on the democratic path.
After casting his own ballot elsewhere in Nouakchott, a bespectacled Aziz, sporting a billowing white robe, vowed he would "bring change, development and prosperity" to Mauritania and win enough votes to avoid a runoff.
Aziz has taken advantage of the machinery of state to cast himself as "president of the poor," in part by dramatically lowering prices on electricity, water, sugar, and gas by as much as 30 percent.
He has also tried to win over a sceptical populace by paving roads and carrying out other public works projects.
During the campaign, rival parties pitched billowing Arabic-style tents in dunes throughout the countryside and all over sandy Nouakchott roadsides in what amounted to nomad-style advertisements. Each tent was affixed with a candidate's image, couches and carpets on which tea was served and politics discussed.