Guinea was eliminated when Mali came from behind to beat Botswana 2-1 in Group D's other game to go through.

Ghana, which only needed a point to progress as group winner, led in the 28th minute at Stade de Franceville through a long-range volley by Emmanuel Agyemang Badu.

Guinea equalized in first-half stoppage time when Abdoul Razzagui Camara's attempted cross looped over 'keeper Adam Kwarasey and into the far corner.

Guinea pushed forward desperately in the second half and strikers Sadio Diallo and Ismael Bangoura both came close before Mamadou Dioulde Bah was sent off in the 70th.

In the other group match, Mali fell behind to Botswana after Mogakolodi Ngele met a low cross with a firm finish in the 50th minute.

That goal briefly lifted Guinea into second place, but Garra Dembele put Mali back into the qualification spots with a close-range equalizer in the 56th before Seydou Keita made the game safe with a winner curled into the top corner in the 74th.

The results left Ghana atop the standings with seven points, followed by Mali on six and Guinea on four.

Needing a freak set of results to progress, Botswana slumped to a third straight defeat in its debut appearance in the African Cup finals.

Ghana will play Tunisia in the quarterfinals, with Mali facing co-host Gabon. The other last-eight fixtures are Zambia vs. Sudan and Ivory Coast vs. Equatorial Guinea.