Mali out despite win over Malawi
Mali finished third on four points, with hosts Angola qualifying top with five points following a 0-0 draw with second-placed Algeria (4), who advanced by virtue of their head-to-head record with Mali.
Malawi were bottom with three points.
Mali, who lost 1-0 to Algeria last week, have not made it past the first round since 2004 when they reached the semi-finals.
Striker Mamadou Bagayoko was not pleased the head-to-head record decided Mali's fate because they had a better goal difference than Algeria (+1 against -2).
"This is really disappointing," he told reporters. "They changed the rules this year and we are out despite finishing ahead of Algeria (on goal difference).
"It's a pity because we have a really talented bunch of players. We had the weapons to do something at this African Nations Cup."
Mali made a flying start when Frederic Kanoute volleyed home a clumsy clearance by Malawi keeper Swadick Sanudi after 38 seconds.
They went 2-0 up in the third minute when Seydou Keita fired a 25-metre free kick straight into the top right corner of the net.
Bagayoko came close to a third when he unleashed a volley from the edge of the box that was tipped away by Sanudi at the end of a swift counter attack.
Although they were without the suspended Mahamadou Diarra, Mali were completely on top in midfield.
Malawi had a chance to pull a goal back in the 24th minute when a low shot by Esau Kanyenda was blocked by keeper Mahamadou Sidibe.
Russell Mwafulirwa finally pulled one back after 58 minutes from a packed goalmouth after Sidibe failed to control a cross from the left.
Mali, though, piled on the pressure again and Keita was superbly denied by Sanudi before being brought down in the box although referee Rajindraparsad Seechurn turned down penalty claims.
Mwafulirwa missed a gilt-edged chance to grab an equaliser in the 70th minute when he missed an open goal by heading down and over the bar.
Bagayoko put the result beyond doubt with five minutes left, heading in a Modibo Maiga cross from the right.
Malawi coach Kinnah Phiri said: "We came as underdogs but the players fought in this tournament.
"In football we must accept defeat. We learned a lot throughout."