Islam Slimani's 60th-minute goal helped Algeria claim a 1-1 draw against Russia on Thursday at the Arena da Baixada, sending the Desert Foxes to the second round for the first time in the nation's history.
Algeria entered the match knowing that a draw would likely be enough to see them reach the next round, while Russia needed three points to have a chance at advancing.
The Russians couldn't have asked for a better start as Alexander Kokorin's header put the team up 1-0 after just six minutes.
However, Slimani equalized on the hour mark, allowing Algeria to finish second in Group H behind winners Belgium, which notched a 1-0 win over South Korea to finish in first place.
Algeria will now face Germany on Monday in the round of 16, while Russia ends its tournament with two points, leaving Fabio Capello's men in third place.
Russia made the most of its first chance of the match in the sixth minute when Dmitriy Kombarov got down the left wing and delivered a cross to the middle of the area for Kokorin, who timed his run perfectly and sent a powerful header past goalkeeper Rais M'Bolhi.
Oleg Shatov went close with a shot from 25 yards for Russia, while Slimani nearly found the net in the 30th minute when his header was tipped over the crossbar by Russia goalkeeper Igor Akinfeev.
But Akinfeev was picking the ball out of his net in the 60th minute when he failed to get a hand to Yacine Brahimi's free kick, allowing Slimani to nod home the equalizer.
Algeria had to see out the final 30 minutes in order to book its place in the next round, and the team was able to do so with little trouble as Russia could only manage to put four shots on target over the course of 90 minutes.