Mendes, who was in the team when the Cape Verdians previously reached the last eight in 2013, blasted home the spot kick to hand the islanders a deserved triumph after they had dominated another fast and furious affair.
The penalty was conceded by Mauritania goalkeeper Babacar Niasse, who was forced to come out as he scrambled to get to a poor back header from Yassin Cheikh El Welly and, in the process, brought down substitute striker Gilson Benchimol.
Cape Verde, with a population of some 600,000, will meet either Morocco or South Africa in the last eight on Saturday.
They were the first team to secure a place in the knockout phase after beating Ghana and Mozambique in their opening Group B games and were confident against Mauritania, who upset Algeria in their last game to reach the knockouts for the first time.
Mendes had an early opportunity to score the opening goal, breaking through from the halfway line in the third minute and into the penalty area but his shot was deflected off a defender's boot and away for corner.
Six minutes later he produced a super first touch to take a long pass out of the air and in the same movement fire at goal from an angle but was narrowly wide.
Cape Verde's high pressing game put Mauritania on the back foot but clear-cut chances were in short supply with Bebe having a long-range shot blocked in the 25th minute and Jovane Cabral’s angled effort was punched away by Niasse.
Mauritania had good opportunity from a 57th minute free kick when Aboubakary Koita's dipping effort flew towards goal and onto the roof of the net.
They had an even better chance two minutes later as Amar Sidi Bouna fed Souleymane Anne who was clear on goal but missed from close range with a left-foot effort that swerved away from the target and clipped the outside of the woodwork.
But then Cape Verde ratcheted up the tempo, winning a series of corners in the last 15 minutes, but Niasse made some decisive saves while Cape Verde’s shooting also let them down.
It was the relentless pressure, however, that forced the error that led to the penalty and a dramatic finish.
“It’s sad for us but we’ve had a great tournament. We missed a little experience, speed and continuity,” said losing coach Amir Abdou.
Forum