The team became the first to join host Cameroon in the tournament scheduled for 2019.
Tuesday’s game was Madagascar’s 20th attempt to qualify for the African Cup. After nearly 50 years of failures, the island nation beat visiting Equatorial Guinea by a goal to nil to seal their place.
The goal was scored by Thailand-based Nijiva Rakotoharimalala at the tail end of the first half.
The Indian Ocean Island was one of four teams to make it through Tuesday to an expanded Cup of Nations, which will have 24 teams next year, up from the usual 16.
Senegal won 1-0 in Sudan thanks to a late goal from Sidy Sarr. Egypt’s 2-0 away win over eSwatini was made without the injured Mohamed Salah.
Uganda need a point from their last two qualifiers to reach the finals after beating Lesotho 2-0 away and Guinea are also on the cusp despite giving up a late goal and being held 1-1 in Rwanda.
Côte d’Ivoire still has some work to do after they were held 0-0 away in Central African Republic.