( CNN ) -- Tunisia and co-hosts Gabon secured dramatic last-gasp victories to reach the quarterfinals of the Africa Cup of Nations Friday . Tunisia needed a final minute goal from Issam Jemaa to beat Niger 2-1 while Gabon came from behind to beat Morocco 3-2 with their winner in the eighth minute of added time . It left them tied on six points and assured of a place in the last eight , while Morocco and debutants Niger are going home and are pointless with a match to play in Group C. The first game in Libreville saw Niger put up a brave challenge and Tunisia coach Sami Trabelsi was relieved by his team 's victory . `` We knew Niger would be well organized and rigorous on the counter attack . The spirit of my team was there for all to see . Thank God we were able to win , thank God , '' he told AFP . Tunisia were ahead after only three minutes when Youssef Msakni beat several defenders before shooting home . Blog : Expect more shocks at the Africa Cup of Nations . But within five minutes Niger were level as William Tonji Ngounou scored their first ever goal in the Africa Cup of Nations finals . Niger had the better chances to win the match , but a point was cruelly snatched from them by Jemaa 's late strike . That was forerunner for the drama of the second match of the evening at the Stade l'Amitie stadium and an incredible finish which sent the home fans into wild celebrations . Gabon looked set for a 2-1 victory as second half goals from Daniel Cousin and Pierre-Emerick Aubameyang had put them in control after Houssine Kharja 's first half opener for Morocco . But in the first minute of added time Morocco won a penalty and Kharja equalized with his second of the match . Then up cropped Bruno Mbanangoyes to curl home a free kick in the eighth minute of stoppage time of a remarkable encounter .
Tunisia and Gabon secure second wins in Africa Cup of Nations Group C. Last minute goal from Issam Jemma gives Tunisia 2-1 win over Niger . Co-hosts Gabon later beat Morocco 3-2 to join Tunisia in last eight . Bruno Mbanangoyes grabs dramatic winner for Gabon in stoppage time .