The attack happened in the same district where an American teacher was shot dead last June. The fatal shooting was claimed by al-Qaeda in the Islamic Maghreb.
Christopher Leggett, 48, died outside a private language and computer school that he ran. He had lived for several years in Mauritania.
No 'clear winner'
The incident came hours before Mauritanians went to the polls, one year after the overthrow of the country's first elected president, with analysts predicting a victory for General Mohamed Ould Abdel Aziz who led the August coup but resigned from the army to contest the election.
But observers believe that no candidate is strong enough to emerge winner from the first round and that a second round run-off is likely on August 1.
At least 1.2 million of the nation's three million people are eligible to vote.
The election follows an internationally brokered bid led by Senegal to end a political crisis in a country twice the size of France.
Abdel Aziz's biggest challengers are Ahmed Ould Daddah, head of the main opposition party, the Rally of Democratic Forces; Messaoud Ould Boulkheir, a parliamentary speaker and the candidate of the National Front for the Defence of Democracy; and Jemil Ould Mansour, leader of the Islamist party Tewassoul.
Sghaier Ould MBareck, a former prime minister, earlier this month announced that he was withdrawing his candidature to support Aziz, who overthrew Sidi Ould Cheikh Abdallahi as president in the August coup.
In all, nine candidates are standing in the election, designed to restore constitutional democracy to the northwestern African country.