Senegal players celebrate after beating Mozambique and secure a place in the 2023 Africa Cup of Nations. Photo: CAF twitter account
Zakhele Lepasa put South Africa in the lead in the 19th minute, before William Jebor equalised in the 35th minute, then Mabhuti Mayambela clinched the winner in the 54th minute.
South Africa came second in Group K with 4 points, behind already-qualified Morocco who have 6 points.
Liberia have just 1 point after three games but lost any hopes of qualification as the Bafana Bafana have a better head-to-head record.
In Maputo, Boulaye Dia's first-half goal proved the difference for Senegal, as the reigning African champions beat Mozambique 1-0 to maintain their perfect record and seal their qualification for next year's showdown.
The Teranga Lions are top of Group L with 12 points after four games, while Mozambique are second with 4 points, with Rwanda (2 points) and Benin (1 point) in third and fourth respectively.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)