( CNN ) -- Mali and Ghana are through to the semifinals of the Africa Cup of Nations after both achieved hard-fought quarterfinal victories on Sunday . Barcelona midfielder Seydou Keita scored the winning spot-kick for Mali as they defeated co-hosts Gabon 5-4 on penalties after the match finished 1-1 after 120 minutes in Libreville . Meanwhile , an extra time winner from Andre Ayew proved enough for World Cup quarterfinalists Ghana to edge past Tunisia 2-1 in the second match in Franceville . Mali will now face Ivory Coast in the last four , while a semifinal showdown with Zambia now awaits Ghana . Gabon looked on course to reach the last four for the first time in their history when Pierre-Emerick Aubameyang set up Eric Mouloungui for a 55th minute opener . And the scoreline remained that way until six minutes from time when Bordeaux striker Cheick Diabate turned and fired home an equalizer for Mali . With both sides scoring their first four penalties , Gabon 's star player Aubameyang saw his spot-kick saved by Mali keeper Soumaila Diakite , leaving Keita to coolly slot home for Mali . Ghana continued their march towards a fifth Africa Cup of Nations title by seeing off a Tunisian side that ended the match with 10 men . Captain John Mensah opened the scoring for Ghana in the 10th minute , when he headed home a left-wing corner . Tunisia leveled three minutes before the break when Evian striker Sabeur Khalifa bravely headed in Zouhaier Dhaouadi 's teasing cross from the right . But Ghana secured the victory after 101 minutes when Tunisia goalkeeper Aymen Mathlouthi dropped a harmless-looking cross for Ayew to roll home from five yards out . And Tunisia 's hopes of getting back into the game were effectively ended when Aymen Abdennour was sent off for elbowing Ayew .
Mali and Ghana are through to the semifinals of the Africa Cup of Nations . The African champions will play in a two-legged playoff against South Africa, who beat Nigeria 2-1 on aggregate last week. Ghana are taken to extra time by Tunisia before securing a 2-1 success .