The Desert Fox's boss - former City player Djamel Belmadi - opted to rest his star man against bottom side Tanzania and Algeria went in at the break 3-0 up.
Mahrez, saved for the games to come, came on with 16 minutes left, but the game was already comfortably won.
READ: Key dates in July/August
Algeria are one of only three teams to have won all three group matches - hosts Egypt and Morocco being the others - and will now face the third placed side from Group A or B which will be one of Guinea or DR Congo, though his is yet to be confirmed.
Algeria are yet to concede a goal and Mahrez has now won 48 caps for his country, scoring 11 goals and assisted a further 28.
Algeria's Round of 16 game will take place on Sunday 6 July in Alexandria.