Algeria moved up to second in World Cup Group H as they overcame South Korea in a six-goal thriller in Porto Alegre.
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.