The rout followed Algeria's 8-0 home triumph over Djibouti in September, when Slimani scored four goals, and ensured they remained ahead of Burkina Faso in their qualifying group, albeit on goal difference.
Mahrez's 27th-minute goal had Algeria leading 1-0 at halftime, and the floodgates opened after the break as the Manchester City attacker added a penalty, Slimani grabbed two goals in 10 minutes, Sofiane Feghouli scored, and Niger added an own goal.
Algeria now have seven points from three Group A games, matched by the Burkinabe, who defeated Djibouti 4-0 with Abdoul-Fessal Tapsoba grabbing two in their match in Marrakech.
Mohamed Salah, who was prevented from playing for Egypt in their previous home World Cup qualifier due to Britain's COVID-19 quarantine rules, returned to the team under new coach Carlos Queiroz as they took over at the top of Group F from Libya.
Debutant Omar Marmoush scored the only goal in the 1-0 win over Libya in Alexandria as Egypt moved to seven points, one ahead of their neighbours.
Angola defeated Gabon 3-1 at home in the other Group F game.
Jeremie Boga caps Ivory Coast win with amazing solo effort
Sassuolo star Jeremie Boga skips around several defenders to put the finishing touches on Ivory Coast's 3-0 win over Malawi.
Malawi were one of the 12 countries forced to move their home matches to neutral venues after their stadiums were not approved for use in the World Cup qualifiers because of poor facilities.
The African qualifiers continue on Saturday with six more matches around the continent.