Nigeria qualified for their first Africa Cup of Nations since winning the tournament in 2013 after drawing 1-1 with South Africa in Johannesburg.
The draw guarantees the three-time African champions a place in Cameroon with a round of matches still to play.
Despite conquering Africa in 2013, the Super Eagles surprisingly failed to qualify for the 2015 and 2017 finals.
Nigeria led through an own goal before South Africa’s Percy Tau produced a moment of magic to tee up Lebo Mothiba.
The draw takes the Super Eagles to 10 points in Group E, one ahead of South Africa and three more than Libya who roared back into contention when thrashing the Seychelles 8-1 in Victoria.
Libya will now qualify for the Nations Cup if they beat Bafana Bafana in their final match next March.
Nigeria, meanwhile, finish their campaign at home to the Seychelles who have conceded 22 goals in their five group games and prop up the table with one point.
The next AFCON tournament will hold in 2019 in Cameron and four countries have qualified after Saturday match.
Countries that qualified:
Nigeria held 1-1 with South Africa in Soweto, Uganda edged Cape Verde 1-0 in Kampala, Mali beat Gabon in Libreville and Morocco went through after rivals, Malawi, lost in the Comoros.
This is the first time Nigeria is going for AFCON after five years.
A total of nine nations have now booked places at the newly-extended 24-team finals, with hosts Cameroon, Madagascar, Senegal, Egypt and Tunisia securing berths before this weekend.
The Super Eagles’ previous Nations Cup triumphs came in 1980, 1994 and 2013.