Islam Slimani, Rafik Halliche and Abdelmoumene Djabou gave Algeria a 3-0 halftime lead before the Koreans scored with their first shot on goal, Son Heung-min turning smartly in the box to fire between Rais Mbolhi's legs in the 50th minute.
Yacine Brahimi found the net just after the hour to restore Algeria's three-goal cushion, making them the first African side to score four goals in a World Cup game, before Koo Ja-cheol pulled another goal back midway through the second half.
Algeria are second in Group H on three points, ahead of the Koreans and Russia, who each have one. Belgium beat Russia 1-0 earlier on Sunday to seal their spot in the next round.