Whereas Ghana, who clinched first place in Group B, breezed past Niger 3-0 in Port Elizabeth, Mali battled out a war of attrition against the Democratic Republic of Congo to earn the point they needed from a 1-1 draw.
Following a game littered with 51 fouls, Mali set up an intriguing quarter-final against hosts South Africa back in Durban on Saturday.
Ghana, who will play Cape Verde in Port Elizabeth, finished top of the group with seven points followed by Mali (4), DR Congo (3) and Niger on one.
"I am delighted we have qualified, but it was not easy to do so," Ghana coach Kwesi Appiah told reporters.
"But we got an early goal and that settled us down and I thought that we did very well. There is still room for improvement, we are still a developing team but we are half there."
After Sunday's drama when Group A swung this way and that between all four teams before South Africa and Cape Verde reached the last eight at the expense of Morocco and Angola, Monday was tame by comparison.
Ghana went ahead in the sixth minute when Asamoah Gyan struck with a powerful angled shot and they doubled their lead after 23 minutes when Christian Atsu trapped a cross on his chest before volleying home from close range.
Ghana sealed the points and their last-eight slot early in the second half when John Boye tapped in from close range after Niger goalkeeper Daouda Kassaly made a mess of catching a Gyan header and spilled the ball straight to the lurking defender.
Niger battled gamely but never threatened Ghana's dominance and at the end the Ghana players celebrated their victory with thousands of fans who have renewed hope that the four-times champions can win the tournament for the fifth time after a wait of 31 years since their last title.
Mali recovered from conceding a first-minute penalty to draw with the Congolese and dominate a game their opponents had to win to qualify.
They started the night a point behind Mali and ended it in the same position despite being unbeaten. After three draws they are heading home.
Congo were awarded a penalty after just 35 seconds when Momo Sissoko brought down Yves Diba, allowing Dieumerci Mbokani to score his second from the spot at the tournament.
The foul came after a shot from Lomana Lua Lua had bounced back off the post in a dramatic start at a wet Moses Mabhida Stadium. Sissoko almost redeemed himself in the fifth minute with a volley saved by Congo goalkeeper Robert Kidiaba and that point marked a change in the balance of power.
Mali, semi-finalists in last year's tournament, began to dominate in midfield and they were soon level after a run from fullback Adama Tamboura set up Mahamadou Samassa's 14th-minute equaliser.
The game descended into a scrappy, physical affair with many fouls and seven yellow cards.
"It was emotionally difficult knowing what was happening in the other game and knowing we needed just a point. We need to keep up our intensity," said Mali coach Patrice Calderon who will find Saturday's match in Durban even more intense when he is greeted by 50,000 passionate home fans giving him the vuvuzela treatment to spur South Africa on to the semis.
- Sports & Recreation
- South Africa
- Democratic Republic of Congo