The Lyon forward netted twice in each half and the other scorers for the Desert Foxes were Ramy Bensebaini, Baghdad Bounedjah, captain Riyad Mahrez and Ramiz Zerrouki.
Former Leicester City player Slimani took his national team goal tally to 36, matching the record of retired Abdelhafid Tasfaout.
Slimani and Zerrouki were promoted by coach Djamel Belmadi in the only changes from the team that beat Senegal 1-0 in the 2019 Africa Cup of Nations final in Cairo.
Victory stretched the African record for an unbeaten run by a national team to 28 matches with Algeria last losing away to Benin in October 2018.
Djibouti began the match as rank outsiders, lying 152 places below Algeria in the world rankings, and had defender Batio Mohamed Youssouf sent off midway through the first half having conceded once.