Abdoulaye Demba (left) celebrates with Mali scorer Dramane Traore
Mali held neighbours Senegal to a 1-1 draw in the El Menzah stadium as they secured top spot in Group B.
Despite resting Frederic Kanoute, Mali opened the scoring when Dramane Traore headed home just after the half-hour.
Habib Beye drew Senegal level when he converted Henri Camara's free-kick in first-half stoppage time, and El Hadji Diouf hit a post late on.
Senegal will meet hosts Tunisia in the last eight, while Mali face Group A runners-up Guinea.
Mali went ahead when Dramane Traore, who plays his league football for Ismaili in Egypt, scored his first goal at Tunisia 2004 when he rose brilliantly to head a speculative cross from right-back Fousseiny Diawara into the top left-hand corner of the goal.
Yet the Teranga Lions drew level two minutes into first-half injury time as defender Habib Beye flung himself at Henri Camara's free-kick to nod the ball past Mali goalkeeper Mahamdou Sidibe.
Mali's Eagles managed to take the point needed to win the group, and with Kenya beating Burkina Faso in the other game the Senegalese also knew a draw was enough to see them into the last eight.
Although Mali coach Henri Stambouli rested star striker Frederic Kanoute and benched captain Soumaila Coulibaly, the Eagles continued to prove they are one of the teams to beat, playing with conviction throughout the game.
Senegal were from being exciting but they had good chances to win the game.
Just five minutes into the tie, Mamadou Niang tried a shot inside the box but the ball deflected and El Hadji Diouf failed to strike the rebound at goal with any real purpose.
Eleven minutes later, a reckless challenge by Mohamed Lamine Sissoko gifted Senegal a free-kick which was played quickly to Ibrahima Faye who shot from a narrow angle over the bar.
Yet it was Diouf, who was full of running all game, who had the best chance when he hit Sidibe's right-hand post with a left-foot strike from ten yards out with just under twenty minutes left.
Mali's other chance came when Lamine Diatta cleared off his line as the ball was agonisingly heading for goal after Abdoulaye Demba profited from a mix-up in the Teranga Lions' defence to strike at goal.
Senegal: 1-Tony Sylva, 3-Ibrahima Faye, 4-Pape Malick Diop, 7-Henri Camara, 8-Sylvain Ndiaye (14-Ndoye 79), 11-El Hadji Diouf, 13-Lamine Diatta, 15-Salif Diao, 18-Mamadou Niang (10-Sakho 74), 19-Pape Bouba Diop, 21-Habib Beye
Mali: 1-Mahamadou Sidibe; 2-Souleymane Diamoutene, 3-Fousseiny Diawara, 4-Adama Coulibaly, 17-Sammy Traore, 6-Mahamadou Diarra, 12-Seydou Keita, 14-David Coulibaly (11-Sidibe 65), 18-Mohamed Lamine Sissoko (8-Toure 75), 15-Abdoulaye Demba (10-S Coulibaly 82), 20-Dramane Traore
Referee: Divine Evehe (Cameroon)