Ex-England boss Fabio Capello saw his Russia side take an early lead when an unmarked Aleksandr Kokorin headed in from Dmitri Kombarov’s left-wing cross.
But Algeria grabbed an equaliser in the second half as Islam Slimani converted from Yacine Brahimi’s free-kick.
Russia could not score a winning goal as Algeria held on to secure a tie with Germany in the second round on Monday.
However, the north Africans’ equaliser was a controversial one as television pictures showed a laser from the crowd had been shone in the face of Russian goalkeeper Igor Akinfeev moments before the goal.
Nevertheless, the CSKA Moscow custodian will be unhappy with the concession as he came off his line to try to intercept Brahimi’s delivery but failed to get there ahead of Slimani.
The goalkeeper had also made a costly error in his side’s opening 1-1 draw with South Korea as he let a shot from Lee Keun-Ho slip through his fingers and into the net.
Those dropped points proved decisive as Algeria, who failed to advance past the first phase in 1982, 1986 and 2010, joined Group H winners Belgium in the next round.
Capello had guided England into the last 16 in South Africa but his Russia side failed to win any of their three group games in Brazil. They only found the net twice and did not have the cutting edge to score another against the Algerians, despite piling on the pressure in the closing stages.
The Russians – who will host the 2018 finals – knew a victory would put them through to the last 16 and they made a perfect start as they took the lead in the sixth minute.
Viktor Fayzulin released Kombarov and his cross was met by Kokorin, who powered a header from 12 yards past goalkeeper Rais M’bolhi.
Algeria fought their way back into the game, but Akinfeev saved weak efforts from Djamel Mesbah and Brahimi and was also well placed to block Slimani’s powerful header from eight yards.
Russia almost doubled their lead three minutes into the second half, but Aleksandr Samedov was denied by M’bolhi after linking up with Kokorin.
But Slimani, who scored in Algeria’s 4-2 victory against South Korea on Sunday, equalised on the hour with what turned out to be the most important goal in their history.
Russia pushed forward in a desperate attempt to get the goal that would have taken them into the last 16 for the first time since the break-up of the old Soviet Union.
Their best chance fell to Aleksandr Kerzhakov, but his low attempt was saved by M’bolhi as Algeria held on for a historic result.
Algeria v Russia match stats
|Algeria failed to keep a clean sheet for the 11th time in their 12 World Cup matches|
|Algeria become the sixth different African team to make the knockout stages of a World Cup, emulating Morocco, Cameroon, Nigeria, Senegal and Ghana|
|Russia have gone out of the World Cup in the group phase in their last three appearances – 1994, 2002 and 2014|
Algeria coach Vahid Halilhodzic said: “Algeria played a heroic match and our qualification is perfectly deserved.
“During the first half Russia used their experience, my players were a bit naive.”
Russia coach Fabio Capello said: “Our goalkeeper was affected by a laser 10 seconds before the goal. He was blinded by a laser, there are photos, films of it. I’m not looking for excuses. I accept defeats.”
Asked whether he would stay in charge of the Russian side, Capello replied: “If they still want me, yes.”