Islam Slimani ran onto a long ball to flick in the first and a Rafick Halliche header put Algeria 2-0 up.
Abdelmoumene Djabou sidefooted in a third, before Song Heung-min’s low shot pulled one back as South Korea rallied.
Yacine Brahimi added Algeria’s fourth and, despite Koo Ja-cheol scoring a second for Korea, Algeria held on for their first World Cup win since 1982.
Algeria, narrowly beaten by group leaders Belgium in their opening game, knew a second defeat would end their hopes of getting out of the group stage for the first time. They responded in emphatic fashion, becoming the first African team to score four goals in a World Cup game.
A win for the Desert Foxes against Russia will now secure a last-16 spot, and a draw could be enough if South Korea fail to beat Belgium.
Algeria coach Vahid Halilhodzic made five changes from the opening defeat by Belgium and his reshuffle had the desired impact.
Sofiane Feghouli had a strong shout for a penalty turned down when he appeared to have been tripped by Kim Young-gwon before the ball fell for Brahimi to hook over.
Slimani then found space at the far post only to head wide and also badly mistimed a first-time shot from six yards as he met an inviting cross from Aissa Mandi.
But the Portugal-based striker, who was his side’s top scorer in qualifying, did not take long to atone as he outpaced two defenders to get to a long Carl Medjani pass and flick the ball past on-rushing keeper Jung Sung-ryong.
Defender Halliche extended the lead two minutes later with his second goal for his country, a thumping header from an Djabou corner.
And Djabou turned from provider to goalscorer when Slimani slipped a ball across for him to sidefoot home.
South Korea had not managed a shot on target in the first half but pulled a goal back shortly after the break – a mistake from Madjid Bougherra allowing Song to send a shot through the legs of keeper Rais Mbohli.
It was now Algeria’s turn to be penned back and they survived a further scare when Ki Sung-yueng had a long range shot palmed over by Mbohli.
However, Brahimi restored his side’s three-goal advantage when he played a one-two with Feghouli before slotting past Jung.
But a much-improved South Korea were not finished, and after the Desert Foxes failed to clear their lines, Lee Keun-ho played the ball across the box for Koo to slot in, before a tiring Algeria managed to regroup and close out the win.
Islam Slimani has scored 11 goals in 22 appearances for Algeria
Algeria scored with four of their 15 efforts on goal (including blocked shots)
Algeria scored more goals in this match than they did in their preceding seven World Cup matches combined
South Korea have conceded 11 goals in their last four World Cup matches.