The South African national U23 team was desperate for a win after losing their opener 3-1 against hosts Senegal.
After edging neighbours Zambia, they now need to beat Tunisia to progress to the semi-finals of the Afcon U23.
In this game South Africa started well and looked more comfortable on the ball but Zambia grew into the game.
After 20 minutes Benedict Chepeshi struck a great long ranger which SA keeper Jody February tipped over.
It was a clear warning that SA didn’t heed, for in the 34th minute Conlyde Luchanga received a good lofted ball that he expertly volleyed to make it 1-0 to Zambia.
Straight after the interval Menzi Masuku ran into the Zambia box and beat Nsabata with a low shot.
Five minutes later Gift Motupa gave South Africa the lead from a close header.
In the 53rd minute the two goalscorers Motupa and Masuku this time combined for the latter to give SA a two goal cushion.
In the 72nd minute Billy Mutale brought Zambia back in it, another volley.
South Africa held on and await their group decider on Friday.