Cape Verde captain Mendes struck the decisive spot kick in the 88th minute and the Blue Sharks will now face either Morocco or South Africa in the quarter-finals.
Cape Verde, one of the surprise teams of the tournament after finishing unbeaten at the top of Group B ahead of Egypt and Ghana, were second best for most of the first half, but finished strongly to secure their passage.