Huddersfield striker Steve Mounie scored the goal to send Benin to the 2019 Africa Cup of Nations after a 2-1 victory over Emmanuel Adebayor's Togo in Cotonou.
In the final round of qualifiers, Benin secured the points they needed to finish as runners-up to Algeria in Group D and secure their place at Egypt 2019.
Benin opened the scoring against Togo in the 12th minute when David Djigla put the hosts in front.
Veteran Togo striker Adebayor, 35, gave Togo hope with an equaliser in the 72nd minute as his side searched for the victory they needed.
It made for a frenetic finish to the contest and the host nation made it a disappointing end to Adebayor and Togo's campaign as Mounie struck seven minutes from time to give Benin the win.
Benin will play at the Nations Cup finals for the first time since 2010.
The 2019 Africa Cup of Nations will, for the first time, take place in June and July and will feature 24 teams rather than 16.
Also on Sunday, Zimbabwe and DR Congo qualified for the finals, as did Tanzania who beat rivals Uganda 3-0.
In Bangui, it finished 0-0 between Central African Republic and Guinea in Group H, a fixture featuring two teams who have already been eliminated.