City winger Mahrez, who started the Desert Foxes’ opening game against Belgium, was an unused substitute for the last-16 clash against the Germans in Brazil, with the victors now going on to face France in the quarter-finals on Friday.
Vahid Halilhodzic’s Algeria were huge underdogs against the much-fancied German side, but they went close to upsetting the odds on a number of occasions during the match, and could count themselves unfortunate not to be ahead by half time.
Islam Slimani had a goal correctly chalked out for offside in those opening stages, while the outstanding performance of Germany’s goalkeeper Manuel Neuer frustrated them on a number of occasions.
In the second half a below-par Germany rallied, but found Algeria ‘keeper Rais Mbolhi in equally fine form as he produced brilliant saves to deny Philipp Lahm, Bastien Schwinsteiger and Thomas Muller and take the game into extra time.
The Algerian resolve was finally broken when Chelsea striker Andre Schurrle’s instinctive flick edged the Germans 1-0 ahead just two minutes into the first half of extra-time.
Arsenal’s Mesut Ozil added a second in stoppage time, and while Abdelmoumene Djabou grabbed a consolation with seconds to play, it was the three-time champions who would advance.
After becoming the first Leicester City player since Muzzy Izzet with Turkey in 2002 to play at a World Cup, Mahrez will now return to join his club team-mates as they prepare for the 2014/15 Barclays Premier League season.