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'
|Serie A Review: Roma drop more points, Genoa and Fiorentina draw|
|Ligue 1 Review: Marseille return to second, Montpellier held|
|Eredivisie Review: PSV go nine points clear, Twente steal last-gasp win|
|Tunisia 1 Equatorial Guinea 2 (aet): Balboa brace sends hosts through|
|Klopp encouraged by Leverkusen stalemate, as Dortmund hit bottom|
|No-show again from Mourinho after City draw|
|Pellegrini suggests different styles shown by City and Chelsea|
|Le Roy dejected following Congo´s Africa Cup of Nations exit|
|Bundesliga Review: Dortmund bottom, Paderborn thumped|
|Simeone marvels at Griezmann improvement|
|Emulating Messi will be tough for Neymar - Luis Enrique|
|Ibenge revels in DR Congo fightback|
|Reception delights Lampard on Stamford Bridge homecoming|
|Milan to downsize from San Siro|
|League Two Review: Luton claim Cambridge double, Shrewsbury stay top|
|Matic feels the effects of Liverpool match in City draw|
|West Brom lacked tempo, says Pulis|
|Pochettino remains grounded|
|Lukaku can inspire Everton - Martinez|
|Bayer Leverkusen 0 Borussia Dortmund 0: Frustrating draw leaves BVB bottom|
|Chelsea 1 Manchester City 1: Advantage Mourinho as top two share the spoils|
|Pardew laments lack of guile in Everton defeat|
|Poyet hoping to build on Burnley victory|
|Ancelotti lauds ´fantastic´ Benzema|
|Dyche backs Ings to bounce back after ´off-day´|
|Pearson brushes off ´bonus game´ defeat|
|Eibar 1 Atletico Madrid 3: Griezmann and Mandzukic inspire champions´ response|
|Rodgers delighted with Sturridge´s goalscoring return|
|QPR not as bad as scoreline suggests - Redknapp|
|League One Review: Bradford pushed hard as MK Dons go top|
|United killed the game too much - Van Gaal|
|Hughes hails hat-trick hero Walters|
|Congo 2 Democratic Republic of Congo 4: Mbokani strikes twice in remarkable fightback|
|Talks break down over Fletcher´s West Ham switch|
|Scottish Premiership Review: Highland derby all square|
|Championship Review: Derby and Boro stay in touch with leaders|
|Good enough for Real Madrid or Barcelona? - Luongo is Socceroos´ next superstar|
|Bruce backs Elmohamady after ´horrible afternoon´|
|Crystal Palace 0 Everton 1: Lukaku ends Palace run|
|Stoke City 3 QPR 1: Walters hat-trick seals win for hosts|
|Liverpool 2 West Ham 0: Sturridge on target in long-awaited return|
|West Brom 0 Tottenham 3: Kane at the double to down Albion|
|Manchester United 3 Leicester City 1: Van Gaal´s hosts avenge humiliating defeat|
|Real Madrid 4 Real Sociedad 1: Benzema stars in Ronaldo´s absence|
|Sunderland 2 Burnley 0: Defoe nets in routine victory|
|Roma snap up Doumbia|
|Huddersfield defender Smith stable after being airlifted to hospital|
|Carver: More to come from Cabella|
|Ivory Coast v Algeria: Renard demands success|
|Match winner Troisi hails Socceroo colleagues|
|Ghana v Guinea: Grant´s men tackle team happy with their lot|
|Australia deserved victory - Ki|
|Inzaghi ready to unleash duo against Parma|
|Cahill: Socceroos triumph to super-charge football in Oz|
|Hull City 0 Newcastle United 3: Carver up and running after routine win|
|Stielike: South Korea still champions|
|Recruitment proving difficult for Mancini|
|Postecoglou targets World Cup impact|
|Allegri dismisses talk of Vidal rift|
|Australia 2 South Korea 1 (aet): Troisi seals Socceroos´ maiden Asian Cup title|
|Ibrahimovic questions PSG fans|
|Azpilicueta anticipating ´weird´ Lampard return|
|Sinclair: Milner praise for Villa made my decision easy|
|Van Gaal fumes at questions on Herrera´s future|
|Cork excited about new challenge|
|Arsenal still gunning for glory - Gibbs|
|Quinteros named Ecuador coach|
|Sturridge eager to prove fitness|
|Blanc: ´We were expecting better´|
|Hecking proud of Wolfsburg|
|Boateng urges Bayern to learn from Wolfsburg thrashing|
|Sporting Braga 1 Moreirense 0: Santos the hero for hosts|
|Cordoba complete triple swoop, Levante bring in two|
|Partick Thistle 0 St Mirren 1: Debutant Dayton the hero|
|Rayo Vallecano 1 Deportivo La Coruna 2: Borges debut double downs hosts|
|Bournemouth 2 Watford 0: Championship leaders stroll to success|
|Dordrecht 0 Heerenveen 0: Visitors´ woes compounded by Sinkgraven sale|
|Paris Saint-Germain 1 Rennes 0: Lavezzi goal enough for champions|
|Palace confirm Souare capture|
|Barcelona v Villarreal: Xavi looking to put high-flyers in their place|
|Simeone denies gesture towards referee|
|Wolfsburg 4 Bayern Munich 1: Dost and De Bruyne at the double as hosts honour Malanda|
|Ben Arfa ineligible to play for Nice|
|Ginola calls time on FIFA presidency bid|
|Cork seals Swansea switch|
|Arsenal v Aston Villa: Wenger lauds team spirit|
|Strootman out for longer than expected|
|Southampton v Swansea City: Monk eager for return to form|
|Injury blow for Southampton striker Long|
|Montella confirms Cuadrado will join Chelsea|
|Bordeaux bring in Chantome from PSG|
|Huth suspended for two matches over tweets|
|Udinese v Juventus: Pirlo not taking Serie A lead for granted|
|Carlisle to return home|
|Prince Ali outlines campaign after submitting FIFA president bid|
|Costa must improve behaviour - Pellegrini|
|Olic seals Hamburg return|
|FIFPro planning legal action to protect unpaid players|
|Burnley rule out Liverpool move for Ings|
|Pochettino fumes at Tottenham schedule|
|Cork set for Swansea switch|
|Hull left in the cold by local gas board|
|Ancelotti: No repeat of Ronaldo indiscretion|
|Murray signs Palace extension|
|Garcia: Roma will sign a replacement for Destro|
|Sassuolo v Inter: Ranocchia hopes turning point has come|
|Congo v Democratic Republic of Congo: Neighbours clash in AFCON quarter-final|
|Fletcher in West Ham talks|
|Tunisia v Equatorial Guinea: Favourites wary of hosts|
|Carrick to miss four weeks|
|Figo submits bid for FIFA presidency|
|Costa hit with three-match ban|
|Villa confirm Sinclair loan|
|Hull agree fee for N´Doye|
|Milan clubs should merge, says agent Raiola|
|Redknapp brands Fer speculation ´absolute rubbish´|
|Destro completes Milan move|
|Iraq 2 UAE 3: Khalil´s brace sees off Iraqis|
|Ward-Prowse signs Southampton deal|
|Mandanda: Marseille will turn it around|
|Fuchs backs Schalke goalkeeper Giefer to shine|
|Wenger unlikely to risk Sanchez, could start Gabriel|
|Newcastle would need ´ridiculous´ bid to sell Sissoko|
|Kramer sure of sustained Champions League challenge|
|Sturridge would have steered Liverpool to Wembley - Rodgers|
|South Korea claim underdog status|
|We can handle the pressure, says Postecoglou|
|Cheyrou joins Toronto|
|AFC boss rejects Australia expulsion claims|
|Australia v South Korea: Socceroos eyeing maiden Asian Cup|
|Wolfsburg plan Malanda tribute|
|Blanc: Ibrahimovic, Cavani need to improve partnership|
|NBA´s Kings invest in Sacramento Republic|
|Djukic slams Ronaldo as ´ugly and conceited´|
|Marcelino hails Villarreal´s historic achievement|
|Destro: I want to show Milan are great|
|Copa del Rey Review: Aduriz breaks drought to send Bilbao through|
|Blaszczykowski to miss Leverkusen clash|