Saifeldin Malik gave the host a fifth-minute lead in a clash of former African champions by heading past goalkeeper Ronwen Williams off a free- kick.
Mohammed Abdelrahman doubled the lead on 31 minutes, taking advantage of hesitancy by captain Thulani Hlatshwayo before firing past Williams at his near post.
South Africa coach Molefi Ntseki took off star forward Percy Tau just past the hour and surprisingly replaced him with defender Sifiso Hlanti, given the desperate need for goals.
Ghana defeated Sao Tome e Principe 3-1 in Accra in a match played at the same time to finish first with 13 points, followed by Sudan (12), South Africa (10) and Sao Tome (0).
South Africa has gradually faded as a Cup of Nations force after hosting and winning the competition in 1996 and finishing second and third in the next two editions.
Failure to qualify for the 2021 tournament in Cameroon means Bafana Bafana (The Boys) will miss the finals of the marquee African competition for the fourth time in seven editions.
The latest failure is sure to pile pressure on the national football association to ditch Ntseki, with the group phase of 2022 World Cup qualifying starting on May 31.
South Africa is in the same group as Ghana, Zimbabwe and Ethiopia and only the winner of the six-matchday mini-league advances to the final round.
Ghana has proved consistently superior to South Africa in recent years, including winning at home and drawing away in 2021 Cup of Nations qualifying.
Former national under-17 coach Ntseki was a shock choice to succeed England-born Stuart Baxter two years ago given he had never handled a senior-level team.
Crystal Palace forward Jordan Ayew was among the scorers for Ghana against Sao Tome, the only team among the 48 in the group phase to lose all six matches.
Arsenal midfielder Thomas Partey also started for the Black Stars, whose last of four Cup of Nations titles came 39 years ago.
Tunisia beat Equatorial Guinea 2-1 in Rades in a match between countries who had already qualified from Group J while Tanzania edged Libya 1-0 in Dar es Salaam in the same section.
Both teams conceded an own-goal in Tunisia after Seifeddine Jaziri raised his goal tally to three from two matches by holding off three Equatoguinean defenders to score in the fourth minute.
Guinea, which secured a place at the 24-team tournament earlier this week, surrendered an unbeaten Group A record when losing 2-1 to Namibia in Windhoek.
Captain Peter Shalulile was the Namibian star, scoring in each half after Mamadou Kane had given Guinea an early lead.