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'
|Bojan fails to inspire Stoke|
|Long on target as Hull held by Barnsley|
|Cardiff issue Medel warning|
|Ferreyra sorry for late Shakhtar return|
|Payet rules out Swansea move|
|Gilchrist nets winner as Burnley edge Accrington|
|Cazorla optimistic for new season|
|Celtic suffer St Pauli defeat|
|QPR lose on Ferdinand debut|
|Mashaba handed Bafana Bafana role|
|Van Aanholt eager to prove himself|
|Areola completes Bastia loan switch|
|Ospina imminent, but Szczesny gets Wenger´s backing|
|Reus happy with progress|
|Alleged spot-fixers released|
|Giuly: Mathieu can be the next Abidal|
|Allardyce hoping to keep hold of Morrison|
|Monk hails quality of Swansea additions|
|Van Gaal orders United players to speak English|
|Allardyce: We must improve|
|Campbell thrilled by Palace switch|
|Bojan drawn by Stoke style|
|Palace were wasteful, says Pulis|
|Van Gaal suits me - Cleverley|
|Newcastle stay perfect in NZ|
|Van Gaal prepared to wait for Strootman|
|West Brom overcome Sacramento|
|Colorado Rapids 3 Chivas USA 0: Hosts rise to third in the West|
|Gameiro brace adds to West Ham woes|
|Villas-Boas: Rodriguez best suited to no.10 role|
|Cazorla: I´m happy at Arsenal|
|Reina respects Liverpool contract|
|Lampard could move to Melbourne on loan|
|Galliani: Balotelli ´99.9 per cent´ staying|
|Own goal helps Palace win in Philadelphia|
|Mourinho: Shaw deal would have ´killed´ Chelsea|
|Al Ahli Benghazi 0 ES Setif 2: Visitors on verge of semi-final spot|
|Julio Cesar returns to QPR|
|Rooney wants to lead United|
|Lallana to miss up to six weeks with knee injury|
|Isgrove maintains Koeman´s perfect start|
|Lens announce Ligue 1 appeal success|
|Pekerman talks due in August|
|PSG sanction ´harsh´, claims FFF chief|
|Garcia: Strootman going nowhere|
|Van Aanholt departs Chelsea for Sunderland|
|Benfica sign Manchester United flop Bebe|
|Campbell makes Palace move|
|Reed signs new deal at Southampton|
|Juve stunned in Allegri´s first match|
|AFA fined over Falklands banner|
|Robinho likely to move, claims agent|
|Drogba completes Chelsea return|
|Kiyotake moves to Hannover|
|Marotta: Juventus eyeing striking additions|
|Bakayoko set for Monaco switch|
|J.League Preview: Vortis out to improve dismal fortunes against Ardija|
|Juve complete Pereyra deal|
|Ranieri named Greece head coach|
|Fiorentina agree Basanta deal|
|Di Natale backs Pereyra´s Juve move|
|Iniesta: Suarez has talent to restore Barca glory|
|Cerci in charge of his future, says Cairo|
|West Ham target new striker|
|Pardew hopeful over De Jong|
|Rodgers expects new Gerrard deal|
|Jones: United embracing Van Gaal methods|
|Henry: Time had come to sell Suarez|
|Brunt eyes new West Brom deal|
|Arsenal´s World Cup winners to miss league opener|
|Modric hails Rodriguez, Kroos signings|
|Cech does not want bench role|
|Inzaghi blames fatigue for Milan loss|
|Real´s time to shine, says Ancelotti|
|Real Salt Lake 3 Montreal Impact 1: Garcia stars in Utah|
|Downing: Carroll injury a ´big blow´|
|Irvine: I have not seen Ideye play live|
|Olympiacos triumph in Toronto|
|Giggs likens Van Gaal to Ferguson|
|Copa do Brasil Review: Corinthians among trio on the verge of progression|
|Blanc: World Cup stars will move on|
|Pinto steps down as Costa Rica coach|
|Mourinho planning Drogba swoop|
|UEFA Europa League Review: Rosenborg complete comeback to see off Sligo|
|Mathieu out to enjoy Barcelona move|
|Mandzukic not Diego Costa´s replacement|
|Eliseu returns to Portugal with Benfica|
|Sanabria makes Roma switch|
|Carroll to miss start of season|
|Vidal: I´m not going to Manchester|
|Xavi staying at Barcelona|
|Hannover complete Gulselam signing|
|Astori loaned to Roma, Cagliari confirm|
|Nigeria to talk with Keshi over return|
|Gamberini makes Chievo move|
|Besic poised to complete Everton move|
|Marseille move Montpellier fixture from Stade Velodrome|
|CSL Preview: Harbin eye Luneng scalp, Guangzhou face Hena|
|Guardiola preaches patience with Lewandowski|
|Lampard joins New York City|
|Blanc coy on Di Maria speculation|
|CAF Confederation Cup Preview: ASEC coach confident, Al Ahly seek qualification|
|Chelsea loan Piazon to Frankfurt|
|Pochettino has high hopes for Lamela|
|Aguirre appointed as Japan coach|
|Swansea swoop for Montero|
|Pozuelo makes Vallecano switch|
|Fred back at Shakhtar, Ismaily to follow|
|CFF investigate Fofana accusations|
|Suarez could make sensational Clasico debut|
|Ribery in line for return, says Guardiola|
|Reus could resume training in two or three weeks - Klopp|
|Roma need another defender, says Garcia|
|Everton on verge of new signings|
|Rodrigo hails Nuno after Valencia switch|
|Delph eager for new Villa deal|
|Ljajic not seeking Roma exit|
|Talks held as players strike in Ecuador|
|Crouch excited by Bojan capture|
|Lambert expects swift recovery for Cole|
|West Ham duo fail to travel|
|United to play 3-4-3, says Van Gaal|
|Lallana, Markovic set to feature against Olympiacos|
|Real want to win every trophy, says Bale|
|San Jose Earthquakes 5 Chicago Fire 1: Hosts break winless streak|
|Chelsea have "outstanding squad" - Costa|
|United make winning start under Van Gaal|
|Rodgers plays down Borini injury concerns|
|Atletico Mineiro 4 Lanus 3 (agg 5-3): Own goals gift Brazilians the win|
|Dunga names Brazil assistants|
|Man City show class in Kansas|
|Villa too good for Dallas|
|Santos cannot meet Robinho´s demands, says vice-president|
|Mourinho happy with goalkeeper situation|
|Borini hurt as Liverpool lose to Roma|
|Palace held to draw by Crew|
|Tottenham down Toronto after Lamela brace|
|San Lorenzo 5 Bolivar 0: Hosts close in on Copa Libertadores final|
|Sunderland forward Scocco joins Newell´s|
|Rodgers: We won´t overpay in transfer market|
|Maccabi Haifa friendly abandoned after pitch invasion|
|USA dynamo Beasley joins Houston|