Senegal secured their slot to defend their Africa Cup of Nations trophy following a 1-0 victory over Mozambique.
Boulaye Dia scored the only goal of the game in the 18th minute at the Estadio National do Zimpeto in Maputo.
The success on Tuesday night gave Aliou Cisse's side 12 points from their four games and passage into the 2024 tournament in Cote d'Ivoire.
Mozambique will vye with Rwanda and Benin for the second qualifying slot.
"I'm very happy and very satisfied," said Cisse. "We came to Mozambique to qualify and we knew that it was a difficult place to win.
"Senegal hasn't won very often here and many African teams have not won here. So we are very happy because not only do we continue our unbeaten run in these qualifiers but we've gone through to the next Cup of Nations."
Senegal beat Egypt in a dramatic final in Yaounde in February 2022 to claim the country's first Cup of Nations trophy.
Defence of crown
Sadio Mane thrashed home the decisive penalty in the shoot-out nearly two hours after missing an earlier spot kick.
Cisse - whose side reached the last-16 at the World Cup in Qatar - said he would give opportunities to squad players during the final two games.
"Qualifying early will allow us to give playing time to youngsters that we are not used to see playing with the Senegalese national team," he added.
The 2019 champions Algeria booked their ticket for Cote d'Ivoire from Group F.
They beat Niger 1-0 on Monday night to seal top spot in the pool with 12 points.
Coach Djamel Belmadi made eight changes to the side that beat the same opponents 2-1 on 23 March.
"I put in a new look defence," said Belmadi. "I took a risk but it was worth it. The objective by 2024 is to have at least two systems of play that we are completely comfortable with."
Tanzania, Uganda and Niger will compete for the other spot from the group.
Elsewhere, in Group K, with the 2022 World Cup semi-finalists Morocco already through, South Africa advanced to the finals for the first time since their run to the quarter-finals in 2019 with a 2-1 win over Liberia on Tuesday.
"This is a country that normally should be at every Cup of Nations," said South Africa coach Hugo Broos.
"I did not understand why we couldn't qualify in the last years. This win was important for us because we have a new team with young players and we did it.
"We can only progress over the next 10 months with good preparations against opponents from whom we can learn something," said the 70-year-old who led Cameroon to the 2017 Cup of Nations title.
Tunisia moved into a 16th consecutive Cup of Nations following a 1-0 victory over Libya. Haythem Jouini scored the winner in the 16th minute.