Itumeleng Khune gifted Mauritania a fifth-minute lead after dropping a direct free-kick from Aly Abeide, which was struck from a long distance out, into his own goal. Probably the worst mistake he has ever made in his career.
Bafana Bafana were on the back foot from that blunder onwards as they struggled to cope with the high and unpredictable bounce of the ball on the Olympic Stadium pitch.
Mauritania, meanwhile, played full of confidence and were buoyed by their early lead. They were first to every 50-50 challenge and hassling Bafana at every turn, with their defence predicting and intercepting every attempted final pass from the South Africans.
Shakes Mashaba's side tried hard to launch attacks but were unable to keep any meaningful possession, let alone play their trademark, quick, short-passing game, and were generally outmuscled and outsmarted by a hungrier-looking home team.
Bafana's only real sights of goal came from a speculative Thulani Serero volley on his left foot from outside the box when he was unable to apply the dip on the ball as it went over the bar, and Mandla Masango's woeful direct free-kick that he skied into the stands.
Dean Furman, who had been unable to impose himself in his usual manner against bigger and more physical opponents, picked up the only yellow card of the first half in the 37th minute.
In the second half it went from bad to worse for South Africa when defender Siyabonga Zulu committed a last-man foul on a Mauritania striker, who would have had just Khune to beat had he not been shoved to the ground by the Platinum Stars centre-back.
Thamsanqa Gabuza restored some hope in the 69th minute with a goal out of nothing, rising highest to head home Anele Ngcongca's searching cross from the right as the Mauritania goalkeeper came out and failed to collect ahead of the Orlando Pirates striker.
But Mauritania substitute Boubacar Beyguily sent the home fans in Nouakchott into raptures less than 10 minutes later as he ran onto a pass from midfield, turned Erick Mathoho inside out to get inside the box and finished low past Khune.
But it got better for the home supporters when Khalil Ahmed scored an absolutely brilliant goal to make it 3-1. Ahmed picked up the ball on the halfway line, cut inside Anele Ngcongca, drove into the box between Mathoho and Andile Jali, then skipped past a missed tackle from Rivaldo Coetzee before beating Khune with a superb finish with the outside of his right boot.
Bafana XI: Khune (c), Ngcongca, Zulu (Sent off 50'), Coetzee, Mathoho, Furman (Zungu 63'), Jali, Serero, Masango (Vilakazi 87'), Gabuza, Rantie (Mashaba 53')
Substitutes: Mabokgwane, Mashaba, Daniels, Makola, Patosi, Vilakazi, Zungu