The Black Stars came from behind to beat South Africa and secure a place in the quarter-finals of the African Cup of Nations as Group C winners.

When Avram Grant's men looked like they were facing elimination, Marseille's 25-year-old star, Andre Ayew, boldly headed home a Baba Rahman cross from the left-flank, to increase Ghana's lead to 2-1 and take them to the knockout stage of the tournament.

South Africa snatched the lead in the 17th minute when Mandla Masango scored opener with a stunning volley from 25 yards.

Ghana were on the front foot, desperately pushing for an equaliser; the captain Asamoah Gyan came close to equalise, but he had his shot cleared by South African stopper Khuzwayo.

The Black Stars dominated the second half, with the ball hardly leaving the Bafana Bafana's end, but they failed to score. Asamoah Gyan came close again, curling another free-kick, but it was over.

Finally, the equaliser for Ghana came in the 73rd minute, when Boye pounced on Ayew's scuffed shot that went underneath Khuzwayo, who was defeated by the spin of the ball. Boye's goal galvanised them; it gave them renewed hope, but they knew another one is needed or they would be heading home!

In the 83rd minute Ayew headed home the winner to send the Black Stars fans into delirium. Baba Rahman delivered a pinpoint cross from the left, which Ayew met with a bullet header from around eight yards out.

The Black Start certainly turned this match around and advanced to the knockout stage. Ayew's header ensured that Ghana, the four - times winners, finished the Group C as winners, ahead of Algeria who beat Senegal 2-0. They will play in the quarter-finals against the runners-up from Group D on Sunday.

Bafana Bafana, will rue the fact that they have taken the lead in all three of their group games at the tournament, but have failed to win any of their Group C matches and will be wondering what might have been in this year's competition after a traumatic time in South African Football over the last year.