Already-eliminated Zimbabwe upset Guinea with a 2-1 win in Yaounde, although Guinea will still advance to the last 16 as runners-up in Group B.
Captain Knowledge Musona and Kudakwashe Mahachi both scored in the first half to earn Zimbabwe a farewell win after losing their opening two matches as they finished last in the group.
Naby Keita pulled a goal back for Guinea early in the second half, but they could not find an equaliser. The Liverpool midfielder was cautioned late in the game for dissent and, in a further blow for Guinea, he will miss their next game in the knockout phase.
Senegal finished top of the group after a goalless draw against Malawi in Bafoussam. Malawi were level with Guinea on four points but Guinea finished second based on their head-to-head result.
Guinea had the first chance of the match when Zimbabwe goalkeeper Talbert Shumba came out to chase a ball but was caught short, offering Sory Kaba the chance to score in the 24th minute.
Yet the centre forward scuffed his shot and Zimbabwe defender Bruce Kangwa got a touch to turn it away.
Two minutes later Musona opened the scoring, rising unmarked in the middle of the Guinea defence to head home from close range.
A second goal followed two minutes before halftime when Mahachi struck a left-footed effort under the body of Guinea goalkeeper Aly Keita.
Guinea got the second half off to a good start as Keita thrashed the ball into the net to pull one back.
It set up an exciting second half as Guinea pressed forward for the equaliser but a makeshift Zimbabwe side held firm to snap a 14-match winless run stretching back to last March.

Heavyweights Senegal failed to fire again and were fortunate not to concede a penalty in a 0-0 draw with unfancied Malawi.
Senegal won the group with five points, despite scoring only once in their three matches via a late Sadio Mane penalty against Zimbabwe in their opening game.
Malawi were left fuming when Cameroon referee Blaise Ngwa cancelled a late penalty he initially awarded them at the Kouekong Stadium in Bafoussam, after Gomezgani Chirwa was brought down in the box by defender Bouna Sarr.
The decision was overturned on review, but Senegal can regard themselves as fortunate as there was both a pull of the shirt and contact.
Malawi used the pace of Frank Mhango and guile of Francisco Madinga to create a number of chances in the opening period that forced the Chelsea keeper into smart saves.
But the best chance of the half fell to Mane, who met Sarr’s cut-back but managed only to scoop the ball over the crossbar with the net gaping.
Mhango had a free-kick that was deflected just wide of Mendy's goal by Senegal midfielder Cheikhou Kouyate, whose earlier yellow card will mean he misses their second round fixture.
Habib Diallo steered a powerful header from a free kick on target but Malawi’s debutant goalkeeper Charles Thom produced a fine save. Thom was in the side because regular number one Ernest Kakhobwe has suspected malaria.