Ghana pipped arch-rivals Nigeria on penalties after a 2-2 aggregate draw, while South Africa slumped to a 4-1 loss at home to Angola, who triumphed 6-1 overall.
Leading nations who will be at the seventh edition of the tournament reserved for home-based stars include Senegal, title-holders Morocco, Cameroon and the Ivory Coast.
Trailing 2-0 after the first leg, Nigeria staged a late rally in Abuja to win the return match 2-0 through goals from Zulkifilu Rabiu and Chijioke Akuneto, from an added-time penalty.
Ghana converted all five spot-kicks in the shootout while Maurice Ugochukwu missed to eliminate 2018 runners-up Nigeria.
The dramatic victory took two-time beaten finalists Ghana back to the finals after failing to qualify for the last three editions.
Although Nigeria boast one of the stronger national leagues in Africa, they have reached the finals only three times, with their qualifying failures including a stunning 2020 loss to Togo.
In Soweto, South Africa got off to a great start with Prince Nxumalo halving the aggregate deficit by nodding home a free-kick just six minutes into the first half.
But disaster struck for the home side on 39 minutes when an attempted headed clearance by Mosa Lebusa looped over goalkeeper Reyaad Pieterse into his own net.
It left South Africa needing to score three unanswered goals to survive with a team sorely weakened by the absence of stars on club duty.
Angola grew stronger as the second half progressed with Jaredi Teixeira a constant menace on the left wing.
He set up the second and fourth goals for Deivi Viera and Daniel Kilola, and Joaquim Paciencia netted the third with a free-kick that flew in off the underside of the crossbar.
Cameroon, fourth when they hosted the 2020 tournament, netted twice late in the opening half to beat Equatorial Guinea 2-0 and squeeze through having lost 1-0 away.
Djawal Kaiba broke the deadlock on 43 minutes in the northwestern city of Garoua and Souaaibou Marou snatched what proved the crucial goal in stoppage time.
There was an even closer call for the Ivory Coast, who beat Burkina Faso on penalties after both legs finished 0-0.
Indian Ocean nation Madagascar will be the only tournament debutants — despite being held 1-1 by Botswana in Antananarivo they progressed 2-1 on aggregate.
FIFA classify Nations Championship matches as full internationals and the results count toward its world rankings.