Ghana's men beat South Africa 4-2 on penalties to win football gold for the first time at the All-Africa Games, after the game ended 1-1 after extra time.
Vusimusi Shongwe and Eugene Riann both missed their spot-kicks, with Ahmed Adams netting the decisive penalty for Ghana.
Both sides defended well in regulation time, making it difficult to create scoring opportunities, but the game opened up in the last 10 minutes and led to a dramatic conclusion.
Ghana striker Osumanu Otoo Mahatma hit the crossbar from 25 metres out on 81 minutes, and five minutes later South Africa took the lead with Eugene scoring from the edge of the box after goalkeeper Daniel Agyei had parried a shot away into his path.
As it seemed that the gold medals were heading the way of the South Africans, Ghana were awarded a penalty in the first minute of stoppage time when South Africa's Wilson Mkhwanazi brought a man down.
Otoo Mahatma Osumanu sent goalkeeper Brilliant Khuzwayo the wrong way to send the game into extra time, where Ghana's Edwin Gyimah had a blistering longshot saved on 104 minutes.
The women's competition was won by Cameroon for the first time as they beat Ghana 1-0 in the final.
Madeleine Mani Ngono headed in a cross in the 56th minute of an uninspiring contest that was played in front of a very small crowd.
The victory is Cameroon's greatest achievement in women's football, although Ghana did not bring their strongest side to the competition.
"We're very pleased, but Nigeria are still the best team in Africa," said Cameroon coach Enow Ngachu.
Ghana coach James Kuuku Dadzie told BBC Sport that despite the defeat the competition has been worthwhile.
"These girls will form the core of the Black Queens squad at the next African Championship because they've been together for so long," he said.