A Teboho Mokoena free-kick goal gave South Africa a 1-0 victory over Ivory Coast on Tuesday at the Under-23 Africa Cup of Nations in Egypt.
Nigeria won Tuesday's other Group B game as they beat Zambia 3-1 at the tournament that also decides the three African teams for the 2020 Tokyo Olympics.
The results mean South Africa top the group on four points, one more than the Ivory Coast and Nigeria, with Zambia bottom on a single point.
It means all four teams can claim a place in the semi-finals with the final Group B games on Friday when Nigeria play South Africa and Zambia face Ivory Coast.
Mokoena, who was a late arrival for finals because his club SuperSport United refused to release him before the tournament began, scored the South African winner on 79 minutes.
The free-kick was in the middle of the pitch, but well outside the penalty area, and Mokoena lifted the ball over a wall of players and Ivory Coast goalkeeper Ira Tape Eliezer.
SuperSport United were not the only club to refuse to release players and consequently South Africa arrived in Egypt last week with just 12 players and only had 15 for the opening draw with Zambia on Saturday.
Nigeria needed 93 minutes to seal victory over Zambia and keep alive hopes of an eighth appearance at the Olympics, where they won gold in 1996 and silver in 2008.
Zambia goalkeeper Mangani Banda raced out of his area to clear in stoppage time, but Taiwo Awoniyi got to the ball first and his angled shot trickled into the net.
Patson Daka had given Zambia an early lead that Orji Okwonkwo swiftly cancelled and Kelechi Nwakali, once on the books of Arsenal, nudged Nigeria ahead off a second-half free-kick.
On Thursday, already-qualified Group A leaders Egypt tackle second-place Cameroon while Ghana must defeat Mali to have any chance of finishing runners-up.
The top three finishers in Egypt will represent Africa in the 16-nation in the men's football tournament at the 2020 Olympics.