Madagascar had a historic first appearance at the Championship of African Nations (CHAN) but Nigeria and South Africa will be notably absent from the 2022 final in Algeria.
Read Also: Mane, Koulibaly, Bassey, Kessie & Aubameyang - The Challenge African Stars Face After Big Moves
Ghana beat arch rivals Nigeria on penalties after drawing 2-2 on aggregate, while South Africa suffered a 4-1 loss at home to Angola, who won 6-1 on aggregate.
Indian Ocean nation Madagascar will be the only tournament debutants - despite being held 1-1 by Botswana in Antananarivo on Friday they progressed 2-1 on aggregate.
Leading nations who will be at the seventh edition of the tournament reserved for domestic-based players include title-holders Morocco, Cameroon, DR Congo, Ivory Coast and Senegal.
The defending champions, hosts Algeria and Libya were already assured of places at the finals after Egypt and Tunisia withdrew from the Northern Group.
The expanded 18-team CHAN finals are scheduled to be held from 13 January to 4 February 2023, and the group-stage draw will be conducted in Algeria on 1 October.
Ghana rule Abuja again
Zulkifilu Rabiu in action for Nigeria
Zulkifilu Rabiu helped Nigeria back into their game against Ghana, but the Black Galaxies prevailed
Trailing 2-0 after the first leg in Ghana, Nigeria staged a late rally in Abuja to win the return match 2-0 through goals from Zulkifilu Rabiu and Chijioke Akuneto, the latter through a 94th-minute penalty.
The Black Galaxies 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.
Africa's most populous nation Nigeria boast one of the stronger national leagues in Africa but have reached the CHAN finals only three times - with their qualifying failures including a stunning 2020 loss to Togo.
It was yet another celebration for Ghana in the Nigerian capital city after pipping their bitter rivals to 2022 World Cup play-off ticket at the same venue in March.
Teixeira helps Angola surprise South Africa
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 Danilson, 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 north-western city of Garoua and Souaibou Marou snatched what proved the crucial goal in stoppage time.
There was an even closer call for Ivory Coast, who beat Burkina Faso on penalties after both legs finished 0-0.
Football's world governing body Fifa classifies CHAN matches as full internationals, and the results count toward its rankings.
Full list of qualified team for CHAN 2022: Algeria (hosts), Morocco, Libya, Senegal, Mauritania, Mali, Niger, Ghana, Ivory Coast, DR Congo, Congo, Cameroon, Sudan, Ethiopia, Uganda, Madagascar, Angola, Mozambique.
CHAN 2022 qualifying - second round second leg results
Western Zone A
Guinea 1-0 Senegal (1-1 agg - Senegal win 5-3 on pens)
Mali 2-0 Sierra Leone (4-1 agg)
Mauritania 1-0 Guinea-Bissau (2-0 agg)
Western Zone B
Burkina Faso 0-0 Ivory Coast (0-0 agg - Ivory Coast win 5-3 on pens)
Niger 3-1 Togo (3-2 agg)
Nigeria 2-0 Ghana (2-2 agg - Ghana win 5-4 on pens)
Central Zone
Congo 1-0 Central African Republic (2-2 agg - Congo win on away goals)
Cameroon 2-0 Equatorial Guinea (2-1 agg)
DR Congo 5-0 Chad (7-1 agg)
Central Eastern zone
Rwanda 0-1 Ethiopia (0-1 agg)
Uganda 3-0 Tanzania (4-0 agg)
Sudan 3-2 Djibouti (7-3 agg)
Southern Zone
South Africa 1-4 Angola (1-6 agg)
Madagascar 1-1 Botswana (2-1 agg)
Mozambique 0-0 Malawi (1-1 agg - Mozambique win on away goals)