Ghana beat hosts Mozambique 4-3 in the All Africa Games men's football competition to secure a place in the semi-finals.
Kwesi Appiah's side, thus set up a last-four fixture with either Senegal or Cameroon, both from Group A on Wednesday.
The Black Meteors were inspired by Mahatma Otoo's hat-trick but the hosts bounced back only for Gilbert Fiamenyo to produce the crucial winner that secured Ghana qualification with South Africa from the three-team Group B.
Having lost their opening game to South Africa 1-0, Ghana needed a win in the decisive game as they went head-to-head with Mozambique.