Ghana secured a place in the African Nations Cup quarter-finals with a dramatic 2-1 victory over South Africa in Mongomo that gave them top place in Group C.
Mandla Masango scored a stunning volley to put South Africa ahead on 17 minutes as they led at the break.
But after incessant pressure from the west Africans in the second half, John Boye found a deserved equaliser, before Andre Ayew scored the winner seven minutes from time to complete the comeback.
The win took Ghana to the summit of the pool on six points, the same as Algeria but ahead of the north Africans on the head-to-head score.
South Africa were in with a chance of qualification for much of the evening though and took the lead with a contender for goal of the tournament.
Jonathan Mensah’s weak headed clearance fell to Masango 25-yards from goal, who from a standing position crashed home a volley that dipped over goalkeeper Razak Braimah.
South Africa had the better of the opening period and were comfortable with their lead at the break, but Ghana roared out of the changeroom in the second period and took control of the game.
It did take them until 18 minutes from the end to draw level as Asamoah Gyan won a header, Ayew miscued a shot and defender Boye blasted the loose ball home.
The insurance goal Ghana needed to advance to the quarterfinals came on 83 minutes as Ayew jumped first to a perfect cross from Christian Atsu to power home a header.
“We deserve it, we showed great character and fighting spirit,” a smiling Ghana coach Avram Grant said after game.
The Black Stars will meet the second-placed side in Group D, which concludes on Wednesday.