Abuja: Ebola-ravaged Guinea joined Ivory Coast, Mali and Ghana in qualifying for the 2015 Africa Cup of Nations on Wednesday but defending champions Nigeria crashed out.
The Nigerians were held to a 2-2 draw by already qualified South Africa on home turf in Uyo to finish out of contention in third in Group A.
Congo, 1-0 winners over Sudan, secured the runners-up spot and the final qualifying berth.
Tokelo Rantie gave South Africa the lead in the 42nd minute, when he sped past Azubuike Egwuekwe from the left flank before he fired past goalkeeper Vincent Enyeama.
Rantie scored his second goal in the 48th minute, when he sliced through the entire Nigeria defence before slotting home.
Nigeria pulled a goal back in the 68th minute through Sone Aluko after a rebound from a shot by Ike Uche which crashed against the post.
The Hull City winger then drew the home team level in stoppage time, but it was too little, too late for the outgoing champions.
South Africa were reduced to 10 men when Reneilwe Letsholoyane was sent off in the 72nd minute.
Also safely across the qualifying line on Wednesday were Ivory Coast, Mali, Ghana and the Guineans.
Qualifying for the continental showcase has gone ahead in the shadow of the current outbreak of the deadly Ebola epidemic which has killed more than 5,000 people and which first struck in Guinea at the start of the year.
It has since claimed almost 1,200 lives in the west African state, infecting around 1,900 Guineans.
Nations Cup organisers CAF have forced Guinea to play their home matches in Morocco, who ironically were last week stripped of the 2015 staging rights after insisting on a postponement because of fears of the spread of the virus.
As a consequence Guinea on Wednesday faced Uganda in the Moroccan port city of Casablanca, winning 2-0.
French-born Guinean Ibrahima Traore put his country in front with a 23rd minute strike. Soumah Seydouba added the second from the penalty spot in the 62nd minute after skipper Andrew Mesigwa was sent off three minutes earlier.
Ghana won Group E with 11 points after a 3-1 home win over Togo.
Guinea finished second on 10 points to ensure their place at the finals now hosted by Equatorial Guinea who earlier in the day announced they had recruited 50 Cuban doctors to help fight Ebola.
Abdulmajeed Waris gave Ghana`s Black Stars a 24th minute lead, with Celtic midfielder Mubarak Wakaso doubling their advantage four minutes later with a rasping shot from outside the box.
Togo pulled a goal back in the 47th minute through Jonathan Ayite but Udinese midfielder Emmanuel Agyemang Badu made the game safe for Ghana in the 68th minute.
Ivory Coast drew 0-0 with Cameroon at home to finish second in Group D on 10 points from six matches and also advance to the tournament. Cameroon won the group on 14 points.
The lacklustre stalemate in Abidjan was in sharp contrast to the thrilling 4-2 home win the Indomitable Lions recorded in Yaounde in the reverse fixture in September.
Cameroon were reduced to 10 men in the 57th minute when skipper Stephane Mbia was sent off for a foul on goal-bound Gervinho at the edge of the box.
DR Congo beat bottom team Sierra Leone 3-1 in the other group game, but it was not enough for them to topple the Ivorians as they finished on nine points.
Mali joined already qualified Algeria at the finals 2-0 home win over the north Africans after closest rivals Malawi were held to a goalless draw in Ethiopia.
Mali veteran star Seydou Keita tucked away a penalty in the 29th minute and then Mustapha Yatabare put the game to bed in the 52nd minute.
Mali ended qualifying on nine points, Malawi recorded seven points and Ethiopia bottom with four points.
Already qualified Zambia edged Group F winners Cape Verde 1-0 courtesy of Kampamba Chintu`s 78th minute strike.
Zambia finished on 11 points, one point behind Cape Verde, while Mozambique and Niger drew 1-1 in Niamey.
Mozambique finished with six points and Niger bagged three points in Group F.
The Africa Cup of Nations takes place in Equatorial Guinea from January 17-February 8.