The match finished 1-1 after extra time and the three-time champions will face hosts Ivory Coast or the Democratic Republic of Congo, who meet later, in the final on Sunday.
Both regular-time goals also came from penalties with captain William Troost-Ekong scoring after 67 minutes for Nigeria and Teboho Mokoena equalised from a 90th-minute spot-kick.
The Mokoena equaliser came after Nigeria thought they had scored a second goal through a tap-in from star forward Victor Osimhen.
But play was called back to the other end of the field after VAR alerted the Egyptian referee that South African Percy Tau had been fouled in the area, and the match official concurred.
Khuliso Mudau had a chance to win for South Africa in added time at the end of regular time, but blazed over after goalkeeper Stanley Nwabali parried a Mokoena free kick.
South Africa finished with 10 men when Grant Kekana was sent off on 115 minutes for a last-defender foul.
Nigeria entered the match with a perfect record against South Africa in the premier African football competition having won three previous meetings.
The Super Eagles beat Bafana Bafana (The Boys) 2-0 in a 2000 semi-final in Nigeria, 4-0 in a group match four years later in Tunisia and 2-1 in a 2019 quarter-final in Egypt.
Nigeria coach Jose Peseiro made one change to the team that beat Angola 1-0, bringing in Bright Osayi-Samuel for left-back Zaidu Sanusi, who did not train on the eve of the match.
Star Napoli forward Osimhen started for the three-time champions after recovering from an abdominal discomfort that delayed his arrival in Bouake from Abidjan.
Osimhen scare
Some Nigerians in the stadium demonstrated their support for Osimhen by wearing replicas of the protective facial mask he still dons three years after suffering an eye socket injury.
Belgium-born South Africa coach Hugo Broos also made one change after victory on penalties over Cape Verde with central defender Siyanda Xulu recalled and Thapelo Morena dropping to the bench.
South Africa had an equal number of shots at goal, but more on target, greater possession, and forced more corners in a tense, lively opening half.
Barely a minute after the kick-off, reigning African Player of the Year Osimhen knelt clutching his abdomen, but he continued after treatment and worked tirelessly.
When pre-match favourites Nigeria were awarded a free-kick, Semi Ajayi headed tamely at goalkeeper Ronwen Williams, who saved four shootout penalties against Cape Verde.
Percy Tau had a couple of half-chances for South Africa, but a weak shot and later a heavy first touch let him down before a 32,000 crowd.
Nigeria goalkeeper Stanley Nwabali, who plays for South African top-flight club Chippa United, produced a good one-hand parry to foil Evidence Makgopa as half-time approached.
With the Super Eagles in the ascendancy, the deadlock ended midway through the second half when Mothobi Mvala fouled Osimhen and Troost-Ekong converted the penalty.
Makgopa fired narrowly wide with 15 minutes remaining as South Africa chased an equaliser in the central Ivorian city.
Then came the disallowed Osimhen goal, the Mokoena equaliser, the Mudau miss and 30 minutes of end-to-end extra time action, including a red card for Kekana, before the shootout.
(AFP)