Zambia moved into second place in Group B as they advanced to four points, but are still five points behind leaders Nigeria, who won 4-0 at home to Cameroon the previous day.
Algeria are virtually out of the race after having qualified for the 2010 and 2014 finals, where they reached the round of 16. They have just a single point with three games to play.
Algeria's preparations were disrupted by a decision to allow African Footballer of the Year Riyad Mahrez to return to Europe to try and secure a transfer away from Leicester City, which proved unfruitful. As a result, he missed the game.
Mwila hit the upright in the fifth minute before finding the net within 60 seconds, rising between two Algeria defenders to head home a cross from Augustine Mulenga.
Teenage prodigy Patrick Daka set up a second goal in the 33rd minute as he cut in to cross for Fashion Sakala, whose scuffed shot was parried by Algeria goalkeeper Rais Mbolhi, with Mwila first to the rebound.
Algeria pulled a goal back with powerful left-footed shot from Yacine Brahimi in the 55th minute and were given a further window of opportunity when debutant Sakala, 20, was dismissed for a second cautionable foul a minute later.
But 19-year-old Enock Mwepu, also making his international debut, came on to score on the counter in the final minute to make sure of home success.
Marc Wilmots led Cote d'Ivoire to a 3-0 win in Gabon in his first competitive match in charge.
Wilmots was brought in as coach after Cote d'Ivoire, the defending champions, crashed out of the African Cup of Nations in Gabon in the first round at the beginning of the year. Cote d'Ivoire eased some of those bad memories on their return to the country, with second-half goals from Max Gradel and two from Seydou Doumbia taking them back to the top of Group C ahead of Morocco.
Senegal and Burkina Faso defences didn't give an inch in their 0-0 draw in a game of few chances in Dakar. Napoli defender Kalidou Koulibaly was sent off for Senegal near the end after his second yellow card.
Burkina Faso still lead Group D and hold the qualifying place but just one point separates the top three teams.