Military council leader Colonel Ely Ould Mohamed Vall named Sidi Mohamed Ould Boubacar as the new prime minister, the government said in a statement on Sunday.
The 49-year-old Boubacar returned to Mauritania on Saturday from France, where he had been serving as ambassador since 2004.
The appointment followed the resignation earlier on Sunday of Sghair Ould M'Bareck and his cabinet. M'Bareck presented the resignations to Vall at the presidential palace.
Cabinet ministers had not shown up for work since Wednesday's coup toppled longtime President Maaoya Sid'Ahmed Ould Taya, who is currently in exile in nearby Niger.
Boubacar had served as prime minister from 1992 to 1996 and also headed Taya's former ruling party until being posted to Paris as ambassador.
On Saturday, Vall met the heads of more than 30 political parties in the capital and pledged that elections would take place in less than two years.
He also assured politicians that no member of his 17-man military council would stand in the vote, said Ahmed Ould Daddah, a top politician who heads the opposition Rally of Democratic Forces.
The coup has been welcomed by many in Mauritania who had grown weary of Taya's harsh rule. Taya had stringently controlled the Islamic country since taking power in a coup in 1984.
But the United Nations and European Union denounced the coup and Washington called for Taya to be restored to power.
The African Union also condemned the military takeover, suspending Mauritania from the 53-nation body.
On Sunday, a judge freed 21 people jailed since 25 April on charges of plotting against the state, said Captain Ahmed Ould Abeid, head of the central prison in the capital.
The military coup has proved to be
popular with Mauritanians
They included Mohamed Hassan Ould Dedew, the spiritual leader of many Mauritanians the government branded as Islamic radicals, and Moktar Ould Mohamed Moussa, an Islamic leader who had previously served as ambassador to the United Arab Emirates.
The group is yet to be acquitted of charges.
At least 50 others still remain in prison on similar charges.
Taya had jailed scores of opponents during his rule, including politicians, soldiers and Islamists he portrayed as terrorists plotting his overthrow.
His main challenger in the presidential elections two years ago, Mohamed Ould Khouna Haidalla, too, was detained for several days just after the 2003 poll.
US, Israel, oil
Taya had allied his overwhelmingly Muslim nation with the United States in its "war on terror".
Mauritania also opened full diplomatic relations with Israel six years ago, becoming one of only three Arab League nations to do so and drawing sharp criticism from Islamist opponents.
Taya's harsh crackdown on opponents is believed to have contributed to bringing on the coup, but a power struggle over recently discovered offshore oil reserves may also have played a role, analysts say.
Mauritania is expected to begin producing crude for the first time in early 2006. Initial output is expected to total about 75,000 barrels a day, significant for an impoverished country, but relatively insignificant compared to regional powerhouse Nigeria, which produces about 2.5 million barrels a day.