(CNN) -- Mali are through to the semifinals of the Africa Cup of Nations after beating South Africa on penalties at the Moses Mabhida Stadium, Durban on Saturday.
Tokelo Rantie gave the hosts the lead after half-an-hour before Mali captain Seydou Keita headed home an equalizer in the 58th minute.
As the game wore on it was South Africa who looked more likely to score, but both sides took fewer chances in attack as full time approached.
Extra time passed without any goals, forcing the match into a penalty shoot-out where Mali held their nerve while the host's lost theirs missing three out of four spot kicks.
Mali will take on the winner of Sunday's quarterfinal between Ivory Coast and Nigeria.
Two second-half goals from Mubarak Wakaso earned Ghana a 2-0 victory over Cape Verde in the other quarterfinal match in Port Elizabeth on Saturday.
Substitute Wakaso scored from the penalty spot in the 54th minute before making sure of the victory with a second goal in the dying moments of the game as the tournament minnows went in search of an equalizer.
The win takes Ghana through to their fourth semifinal in a row, where they will play either Burkina Faso or Togo.