MONGOMO, Equatorial Guinea (AP) — Ghana came back from the brink of elimination with two goals in the last 17 minutes to beat South Africa 2-1 Tuesday and make the African Cup of Nations quarterfinals.
The four-time champion was heading for a rare early exit at the continental championship after Mandla Masango's spectacular volleyed goal for South Africa in the 17th minute.
But a desperate Ghana turned it around in the second half at Mongomo Stadium.
Substitute John Boye scored from close range in the 73rd minute and Andre Ayew headed home 10 minutes later for a victory that took Ghana from exiting the tournament to qualifying as winners of Group C.
Algeria also made the quarterfinals from Group C after a 2-0 win over Senegal in Malabo. Ghana and Algeria ended on six points but Ghana topped the group after beating the Algerians in their meeting.
Ghana's progress was hanging by a threat under big-name new coach Avram Grant. The Black Stars again needed a late surge like the one that gave them a stoppage-time win over top-ranked African team Algeria.
"I'm very happy for the players," Grant said. "Once again they showed spirit. We came through the group of death and we are first."
Although Ghana isn't in top form yet, it is still in the tournament and still has a chance to end a 33-year wait for an African Cup title. Ghana will play the second-placed team from Group D — Ivory Coast, Cameroon, Guinea or Mali — in the quarters. Group D will be decided on Wednesday.
"I think with this team we can face any team in this competition," Ghana captain Asamoah Gyan said.
Ghana had much of the play against a South Africa that had a slim chance of qualifying with a victory, but the Ghanaians couldn't convert their chances until right at the end.
Masango had shocked them by controlling a clearance on his chest near the edge of the area and sending a fantastic dipping volley over goalkeeper Razak Braimah and just under the crossbar for the lead.
Ghana applied pressure throughout the second half and found late inspiration when defender Boye managed to create space for himself to steer home a low shot for the equalizer. Another substitute brought on by Grant, forward Kwesi Appiah, played a crucial role in the winner that kept Ghana alive.
He provided the cross for Ayew to head in, with the winger then wheeling away and diving onto the grass in celebration. His jubilant teammates piled on top of him.
South Africa was eliminated after leading in every one of its three group games and failing to hold on, losing two and drawing one.
"First half we played very well and we got a goal. Come second half, we went to sleep," South Africa coach Ephraim Mashaba said.