Germany were given a major scare before beating Algeria 2-1 on Monday to book a FIFA World Cup quarter-final meeting with France.
After a pulsating 90 minutes in Porto Alegre had ended goalless, Chelsea forward Andre Schurrle - on as a half-time substitute for Mario Gotze - cleverly flicked in Thomas Muller's low cross two minutes into extra-time to give Germany the lead.
Mesut Ozil added a second late on to wrap up victory for Joachim Low's side, before Algeria, who performed admirably throughout, gained a consolation through Abdelmoumene Djabou.
The result meant Algeria were unable to exact revenge for the "Disgrace of Gijon", when West Germany and Austria played out a mutually beneficial 1-0 scoreline that saw both sides through from the group at the expense of Algeria in the 1982 finals in Spain.
With many pointing to that infamous match as motivation for Vahid Halilhodzic's men in the build-up, Algeria flew out of the blocks in the opening 20 minutes, cutting through the German backline on a number of occasions and seeing an Islam Slimani goal disallowed for offside.
The African nation - making their first appearance in the second round - continued to impress, but Germany, who will now face France at the Maracana on Friday, finished the stronger and remain on course to reach the semi-finals of a fourth successive World Cup.
Algeria made a flying start and Manuel Neuer had to make a sliding tackle to deny Slimani an effort on goal from wide on the left in the ninth minute, after the goalkeeper had initially misjudged a charge from his line.
Sofiane Feghouli wasted a good position six minutes later, blazing the ball wildly across goal from the byline with two team-mates better placed.
Slimani converted Faouzi Ghoulam's wonderful cross from the left with a diving header in the 17th minute, but the referee's assistant correctly ruled that the Sporting Lisbon man had strayed offside, before Ghoulam flashed another effort narrowly off target as Algeria continued to dominate.
Germany gradually grew into the game towards the end of the first half, Muller heading wide and Ozil testing Rais M'Bolhi with a dipping effort.
Yet Algeria hit back in the 39th minute, Mehdi Mostefa thumping in a shot from 25 yards which deflected off Jerome Boateng and past the left-hand post with Neuer completely wrong-footed.
M'Bolhi made a superb double stop two minutes later, parrying Toni Kroos' drive away and then springing to his feet to keep out Gotze's rebound.
Germany enjoyed a more assured opening to the second period, Schurrle seeing an effort deflected just wide before Skhodran Mustafi, who replaced Mats Hummels (flu) in defence with Boateng switching to centre-back, headed straight at M'Bolhi from Kroos' delivery.
Philipp Lahm went close in the 55th minute, his curling effort diverted wide by an acrobatic save from M'Bolhi.
As the game wore on the play became stretched and Slimani sent a rasping effort from distance straight into the arms of Neuer 15 minutes from time.
Germany responded strongly and Muller ought to have scored his fifth goal of the tournament shortly afterwards, but his powerful header was beaten away by M'Bolhi.
Muller had another clear chance moments later, stabbing the ball wide after a glorious touch to bring the ball under control, while Bastian Schweinsteiger was unable to seriously trouble M'Bolhi with a weak header from Lahm's chipped pass.
Low's side then struck early in the first extra period, Schurrle adjusting brilliantly to backheel Muller's cross from the left into the net.
Algeria could have levelled through Mostefa, who snatched an effort wide from 10 yards after Germany failed to deal with a corner.
Ozil then made the game safe in the closing stages, lashing high into the net after Schurrle had been denied just in front of the goalline by Essaid Belkalem, although there was one final twist as Djabou converted a right-wing cross at the back post to net a deserved consolation for Algeria.
|Coach: J. Löw|
for M. Götze 46'
for S. Mustafi 70'
for B. Schweinsteiger 109'
|Algeria 1 Tunisia 2: Favourites on brink of elimination|
|Bayern keen to seal Coman deal as Rummenigge cools Gnabry interest|
|Pochettino has done his homework on Jesus as Spurs look to march on|
|Scrap offside? Premier League managers give Van Basten´s plans a cool reception|
|Coman ready for Bayern comeback, confirms Ancelotti|
|Pochettino upbeat despite six weeks out for Vertonghen, Lamela still a mystery|
|Cerezo defiant over Griezmann amid talk of Manchester United agreement|
|Robinho named in Brazil squad for Chapecoense fundraiser|
|Davies and Lookman aren´t the big men of Everton, warns Koeman|
|Ivory Coast v DR Congo: Dussyer demands champions show true strength|
|Replacing Robben and Ribery not easy - Hitzfeld|
|Yeray back in Athletic training after successful cancer surgery|
|Karanka targeting more Boro deals after Bamford swoop|
|Cavani: I am the ultimate finisher|
|Morocco v Togo: El Ahmadi hungry for success|
|Ancelotti denies Verratti approach|
|A-League Review: Cahill double sees Melbourne City sink Mariners|
|Manchester United very happy with Shaw, insists agent|
|Mertesacker extends Arsenal deal|
|Boost for Arsenal as key quartet returns to training|
|Will Jesus save Manchester City´s title bid? Guardiola´s new striker in Opta numbers|
|Tevez mobbed after touching down in Shanghai|
|Payet exit not inevitable - Bilic|
|Wenger: Arsenal don´t need Payet|
|Jesus wants Manchester City titles|
|Orsolini arrives for Juventus medical|
|Rivaldo backs Coutinho to join Neymar at Barcelona|
|No danger of Messi leaving Barcelona, says father|
|Augusto: I convinced Oscar to come to China|
|Madrid-bound Maradona visits Napoli training|
|Sevilla in no rush over Sampaoli talks despite Barcelona links|
|Cafu: Resurgent Brazil can challenge world´s best|
|Klopp thrilled with Coutinho|
|Manchester United replace Real Madrid as world´s richest club|
|Madrid squad annoyed by defeats - Zidane wants more energy after latest loss|
|Casemiro rues more misery for Madrid against Celta|
|´Job done, let´s go home´ - Klopp happy to avoid extra time with narrow Plymouth win|
|FA Cup Review: Southampton leave it late to beat Norwich|
|Real Madrid 1 Celta Vigo 2: Aspas and Jonny extend Madrid winless run|
|Plymouth Argyle 0 Liverpool 1: Rare Lucas goal sees Klopp´s men through|
|Manchester City in La La Land as Schalke toil underground|
|Cameroon 2 Guinea-Bissau 1: Ngadeu-Ngadjui completes comeback to send Broos´ men top|
|Monaco confirm signing of Ajax teenager Antonucci|
|Manchester United´s interest in Griezmann is unsurprising - Simeone|
|Bamford ends spell in Chelsea wilderness with Boro return|
|Louis the great - Luis Enrique explains his and Barca´s debt to Van Gaal|
|Gabon 1 Burkina Faso 1: Spot-on Aubameyang makes his point|
|PSG send Ikone on loan to Montpellier|
|Senegal v Zimbabwe: Cisse wants to live up to favourites tag|
|Ghana´s Rahman leaves AFCON with knee injury|
|Algeria v Tunisia: Mahrez demands improvement in crucial Group B clash|
|Dortmund forward Dembele hits out at Bundesliga refereeing|
|Robben hopes Alonso stays at Bayern amid retirement rumours|
|Asian champions Jeonbuk banned from 2017 Champions League|
|Rakitic still an important player for Barcelona - Luis Enrique|
|Jesus will develop quicker at City - Emerson|
|Always take the weather with you - Spanish snow blights CSKA´s training camp|
|Messi never gave Coach interview, claims father|
|Gotze questions critics but admits to falling short of expecations|
|´Conte can have our title´ - Ranieri wants Chelsea to win the Premier League|
|Tottenham reject Premier League, Bundesliga offers for Wimmer|
|Liverpool sell Ilori to Reading|
|Potential victims in football abuse probe surpasses 500|
|Bonaventura signs new AC Milan contract|
|Messi: Ronaldo has achieved great things|
|Koscielny: Wenger has built men at Arsenal|
|Messi vows to stay at Barcelona ´for as long as they want me´|
|Cafu adamant Neymar will become world´s best|
|I´m just taking a sabbatical - Van Gaal denies he´s retired|
|Not even Gerrard won Premier League - Buttner says he´s not a United flop|
|Samper ignored Wenger as Barca midfielder rejected Arsenal|
|Pleased Pioli wants more from Inter|
|Evergrande boss Scolari dismisses Turan links|
|Klopp seeks legal advice over Matip|
|Marseille complete Sanson move|
|Inter 3 Bologna 2: Candreva prevents remarkable turnaround in Coppa Italia thriller|
|FA Cup Review: Non-league Lincoln stun Ipswich, Burnley and Palace through|
|Gabon v Burkina Faso: Aubameyang says hosts have learned from Guinea-Bissau setback|
|Mali 0 Egypt 0: El-Hadary makes history in stalemate|
|El-Hadary oldest AFCON player ever - 44-year-old Egypt goalkeeper makes history|
|Reus and Gotze on target but Bender injured in Dortmund win|
|Toure shunning lavish China interest to stay at City, says Seluk|
|Rahman´s AFCON in the balance, says Ghana boss Grant|
|Just 14 goals conceded and nine clean sheets - How Vertonghen blow could impact Tottenham|
|Ghana 1 Uganda 0: Andre Ayew hands Black Stars nervy victory|
|Swansea snap up Carroll and Olsson in double swoop|
|All is forgiven? - Costa trains with full Chelsea squad after reported Conte bust-up|
|I would throw myself off a bridge for Luis Enrique - Rakitic dismisses Barca rift rumours|
|Was Juventus´ new logo inspired by tennis star?|
|Smooth sailing for Liverpool in Plymouth? Klopp expects tough test|
|Demichelis re-joins Malaga until end of season|
|Cameroon v Guinea-Bissau: Broos urges new heroes to emerge|
|Boxing champ hits Carragher with Chinese Super League comeback prank|
|Zidane backs Navas and defends Benzema as Madrid aim to bounce back|
|Deportivo bring in Kakuta from Hebei after CSL rule changes|
|Matip could miss eight games without doing anything wrong - Klopp|
|United trigger Valencia´s contract extension|
|Ronaldo returns to Real Madrid´s Copa squad|
|FA fine Sagna for Instagram post|
|Nedved does not foresee more January business for Juventus|
|Rafinha injury blow for Barcelona|
|Villas-Boas fumes at CSL foreign player crackdown|
|Ibrahimovic invaluable to Manchester United youngsters - Rashford|
|Robben rejected China move|
|A-League review: Phoenix rise to the occasion to end Victory´s streak|
|Van Gaal slams English media over treatment at Manchester United|
|Mignolet: Liverpool in better position to win title than in 2013-14|
|Giroud wants Premier League title but understands China temptations|
|Tianjin forced to scrap moves for Costa, Benzema, Cavani and Falcao|
|My goal was better than Mkhitaryan´s - Giroud|
|Pochettino not interested in Argentina job|
|Kane: Tottenham can win Premier League|
|Corinthians dreaming of Drogba - Paulo Roberto|
|Coutinho calls for Liverpool focus|
|Chiellini compares Pogba to LeBron and Bolt|
|Maradona to become Napoli ambassador|
|Mihajlovic furious after Torino collapse|
|Icardi has offers from China - Wanda Nara|
|Pogba can cope with pressure - Ibrahimovic|
|´My half-time words will stay in the dressing room´ - Montella annoyed with AC Milan|