Ghana sealed its place in the quarterfinals at the African Cup of Nations with an unconvincing 1-1 draw against 10-man Guinea on the final day of group matches on Wednesday.
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, but faded away after Mamadou Dioulde Bah was sent off with 20 minutes to go.
The results left Ghana atop the standings with seven points, followed by Mali on six and Guinea on four.
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.
Guinea pushed forward desperately and was on top early in the second half as it chased the win it needed, with strikers Sadio Diallo and Ismael Bangoura both coming close.
Ghana still had an outside chance of being eliminated if it lost but held on, although the Black Stars didn't hit top gear against a tricky Guinea outfit.
"We didn't want to get into a situation of problems,'' Ghana assistant coach Kwesi Appiah said. "It was just important that we qualified for the next stage. At the end of the day, the most important thing is making sure you qualify.''
In the other group match in Libreville, 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 and had Mali going home, but Garra Dembele put the Malians back into the qualification spots with a close-range equalizer in the 56th. Barcelona midfielder Seydou Keita made the game safe with a winner curled into the top corner in the 74th.
Guinea had good chances in both halves in Franceville, being denied an early shout for a penalty and having a 26th-minute goal by Ibrahima Traore ruled out for offside.
Coach Michel Dussuyer congratulated his players for working hard, and "wanting to win,'' but said South African referee Daniel Bennett made some crucial mistakes - including Bah's first yellow card.
"We all know that Ghana is a great team but it didn't need the help of the referee,'' Dussuyer said. "I am very disappointed with the performance of the referee.''
Badu put Ghana ahead with a high-class strike, flicking up a half-clearance on the edge of the penalty area and volleying past Moussa Yattara and into the top left corner.
Ghana was also denied a penalty five minutes before halftime when Asamoah Gyan pushed the ball past Bobo Balde and was clearly held back by the big defender.
Goalkeeper Adam Kwarasey pulled off a point-blank save at the other end a minute later to deny Guinea, as the action swung rapidly from one goal to the other.
Camara equalized in first-half stoppage time to give the Guineans a huge boost. The left winger appeared to be attempting a deep cross from out wide, but the ball went sailing over Kwarasey and into the far corner of the net for 1-1.
Bangoura was denied by Kwarasey early in the second half as the Ghanaians began to look uncomfortable against Guinea's pacey forward line. Pascal Feindouno drove a fierce shot across goal that Zayatte couldn't quite connect with.
The Guinea skipper punched the grass repeatedly with frustration as Guinea slipped out of the tournament.
Ghana: Adam Kwarasey, Asamoah Gyan (Prince Tagoe, 75), John Pantsil, Anthony Annan (Derek Boateng, 76), Samuel Inkoom, Emmanuel Agyemang Badu, Andre Ayew (Charles Takyi, 87), Masahudu Alhassan, Isaac Vorsah, Kwadwo Asamoah, John Boye.
Guinea: Moussa Yattara, Pascal Feindouno (Habib Balde, 76), Mamadou Dioulde Bah, Bobo Balde, Kamil Zayatte, Abdoul Razzagui Camara, Ibrahima Traore (Alhassane Bangoura, 77), Sadio Diallo, Ismael Bangoura (Naby Soumah, 85), Thierno Bah, Ibrahima Diallo.