Guinea scored a late equaliser to earn a 2-2 draw with Tanzania and seal a place in the quarter-finals at the African Nations Championship (CHAN) in Cameroon.
Zambia also progressed from Group D to the last eight with the point they needed after a goalless draw with Namibia.
The Zambians will play holders Morocco in the next round while Guinea face Rwanda with both matches on Sunday.
Saturday's quarter-finals, of the tournament for locally-based players only, sees Mali face Congo Brazzaville and DR Congo take on hosts Cameroon.
Tanzania were just eight minutes away from winning the group when Victor Kantabadouno scored the crucial goal that was enough for Guinea to progress instead.
Guinea had opened the scoring after just four minutes when Yakhouba Barry converted from the penalty spot.
Baraka Majogoro struck on 23 minutes with a goal sure to be a contender for the best of the tournament, as he unleashed a volley that flew into the corner of the net with goalkeeper Moussa Camara a helpless onlooker.
Edward Manyama nodded Tanzania in front on 69 minutes before Kantabadouno also netted the all-important goal for Guinea with his head.
Meanwhile Zambia maintained a record of never losing a group game in four CHAN tournament appearances by drawing 0-0 with Namibia.
Guinea topped the group on goal difference after finishing level on five points with Zambia, Tanzania were a point behind and Namibia bottom with a single point.
Hosts Cameroon edged into the last eight as runners-up in Group A with a win and two draws while Mali topped the pool with two victories and a draw.
Two-time champions DR Congo managed to win Group B despite 12 players and coach Florent Ibenge testing positive for coronavirus during the group phase.
Their neighbours Congo also progressed from Group B with five points.
Defending champions Morocco ended their Group C campaign with a convincing 5-2 win over Uganda to top their pool ahead of Rwanda.
The semi-finals will be played on 3 February with the champion crowned four days later.
Crowds were restricted to 25 percent of stadium capacity during group matches and the organisers hope a higher percentage can watch the knockout phase.