Substitute Mario Mandzukic scored twice as Bayern Munich beat Hertha Berlin 3-2 to extend their unbeaten run to 35 Bundesliga games.
Adrian Lopez gave Hertha an early lead, but Mandzukic scored four minutes after replacing the injured Arjen Robben and then put the Bundesliga leaders in front with another header early in the second half.
Mario Gotze had come on just before the Croatia striker when Toni Kroos also picked up an injury and the midfielder made the most of his chance by scoring a third Bayern goal at the Allianz Arena.
Hertha were dangerous going forward and Anis Ben-Hatira pulled a goal back, but Pep Guardiola's side were not to be denied as they maintained their 100 per cent home record this season.
The victory ensured the European champions are just one game away from equalling Hamburg's 30-year record of 36 Bundesliga games without defeat and they were also boosted by the return of Javi Martinez, who came off the bench to make his first apperance for two months following a knee injury.
Mandzukic and defender Diego Contento dropped to the bench as Thomas Muller and Jerome Boateng returned to the starting line-up after being rested and suspended respectively for the midweek UEFA Champions League win over Viktoria Plzen.
There were two changes to the visitors' starting line-up following their win over Borussia Monchengladbach, as midfielder Tolga Cigerci and defender Nico Schulz were handed starts by coach Jos Luhukay.
And Luhukay's charges stunned Bayern just three minutes in, when the unmarked Ramos rose to meet Per Ciljan Skjelbred's corner and planted a header into the bottom-right corner of Manuel Neuer's net.
Things almost went from bad to worse for the European champions five minutes later as Ben-Hatira's deft lob bounced down off the crossbar with Neuer beaten.
Bayern were struggling to get going until Gotze and Mandzukic replaced Kroos and Robben.
The Croatia striker took just four minutes to make his presence felt as he rose at the back post to head home Franck Ribery's free-kick.
Hertha continued to threaten and it needed a great challenge from Bastian Schweinsteiger to get across and ensure Cigerci's shot deflected over the bar.
Schweinsteiger then showed his class at the other end six minutes after the break as he delivered an inviting free-kick, which Mandzukic met with a downward header into the far corner from 10 yards.
Kraft should really have done better and was beaten again three minutes later. This time Gotze was in the right place to head Rafinha's cross into the far corner as the Hertha keeper scrambled across in vain.
But Hertha were not finished yet and they were back in it on 57 minutes when Ben-Hatira diverted Ramos' mis-hit shot into the roof of the net.
Ramos was a thorn in Bayern's side and his long-range strike was tipped over by Neuer. Ramos also thought he should have had a penalty for a push by Alaba in stoppage-time, but the referee waved play on and Bayern held on for another win.
|5||D. Van Buyten|
for T. Kroos 24'
for A. Robben 26'
for T. Müller 64'
|Wenger: I won´t buy for the sake of it|
|Inter 1 Bayern Munich 4: Hat-trick hero Green enjoys happy homecoming|
|Ibrahimovic keen for ´interesting´ Pogba deal|
|Conte unsure over Costa´s Chelsea future|
|Zidane: Morata will remain a Madrid player|
|New York City 5 Colorado Rapids 1: Lampard hits hat-trick in MLS rout|
|Sergi Roberto ´more than a player´ - Luis Enrique|
|Mourinho hints at United future for Mata and Fellaini|
|Real Madrid 3 Chelsea 2: Hazard show too late for Blues|
|Penalty woes for Everton, Gray treble inspires Burnley at Ibrox|
|Atleti to present Gameiro on Sunday|
|Ibrahimovic nets debut goal as United put five past Galatasaray|
|Barcelona 3 Celtic 1: Messi, Suarez in action as Catalans cruise to victory|
|WATCH: Zlatan open his Man Utd account with acrobatic goal|
|Alba: It would be foolish not to respect Ronaldo, but Messi on another level|
|Lahm hails ´sensational guy´ Schweinsteiger following Germany retirement|
|Stones´ professionalism praised amid City reports|
|Roma suffer Rui blow|
|Inter complete Ansaldi move|
|Nainggolan confident of Roma challenge despite Juve investment|
|Rummenigge tells off Ribery over Guardiola dig|
|Meli makes Sporting loan switch|
|No repeat of slow start, vows Allegri|
|Mourinho desperately wanted Embolo at Manchester United, claims Heidel|
|Dembele can do anything - Tuchel|
|Pogba arrival would boost Rooney - Yorke|
|Ben Yedder makes Sevilla move|
|De Jong signs PSV renewal until 2020|
|Kovacic to fight for his place at Real Madrid|
|Sturridge out to improve goals-per-game ratio|
|Mourinho hails ´humble´ Ibrahimovic ahead of United debut|
|Schweinsteiger will not leave Manchester United for Bundesliga return - Rummenigge|
|Benatia on target again in Juve win|
|Atletico set to sign Gameiro|
|Zenga appointed Wolves boss|
|Flattered Verratti not seeking Madrid move|
|Ancelotti: Growing transfer fees nothing special|
|Eriksson: Ibrahimovic and Mourinho combo enough to win Premier League|
|Meunier: I could not reject PSG|
|Klopp: I didn´t want Mkhitaryan|
|Anything could happen before transfer window shuts - Zidane|
|Montoya leaves Barca base, nears Valencia switch|
|Wijnaldum: I´m happy to play anywhere|
|Klopp backs Mignolet after Karius injury|
|Liverpool suffer Karius injury blow|
|Ranieri confident Mahrez will stay as contract talks continue|
|Emery confirms interest in Jese|
|Higuain´s Juventus move not about money - agent|
|Wolves sack head coach Jackett|
|Zidane: Ronaldo unlikely to play Madrid La Liga opener|
|Ibrahimovic: United fans are waiting for me|
|Deulofeu shines for Everton, Cook opens Bournemouth account|
|Higuain out to emulate Del Piero|
|Kante does his talking on the pitch - Conte|
|Mourinho explains Fosu-Mensah snub|
|Klopp: No more unwanted players at Liverpool|
|Inter want more than €60m for Icardi - Thohir|
|Leicester can replace Kante - Ranieri|
|Lazio complete Wallace signing|
|Gueye set to join Everton, confirms Di Matteo|
|Tuchel: Transfer market has gone cash crazy|
|Leicester hand King new four-year deal|
|No deal done for Pogba, says Raiola|
|Rooney: Mourinho impact already huge|
|Lafferty hit with FA betting charge|
|Top-four finish never enough for Arsenal, insists Wenger|
|Partey hoping to make his mark on Atletico squad|
|Ibrahimovic in, Schweinsteiger out as United head for Galatasaray friendly|
|Vietto set for Sevilla after completing medical|
|I rejected Besiktas to fight for Barcelona spot, reveals Mathieu|
|De Laurentiis fumes at Higuain´s ´lack of respect´|
|Promising Janssen boosts Tottenham´s title hopes|
|Besiktas sign Adriano on three-year contract|
|Tottenham 0 Atletico Madrid 1: Godin grabs the winner|
|Gomis completes Marseille loan move|
|Iniesta surprised at Casillas-Del Bosque spat|
|New Juve signings do not guarantee success - Allegri|
|New Juve signings do not guarantee success - Allegri|
|Middlesbrough snap up goalkeeper Guzan|
|Guardiola still loves Ribery despite jibes|
|West Ham worry over Tore injury|
|Serie A could be another one-horse race, says Eriksson|
|Schweinsteiger retires from Germany duty|
|Iniesta welcomes Barca´s midfield competition|
|Drogba: No luck in Arsenal scoring record|
|Wenger seeks ´experienced´ striker to bolster Arsenal attack|
|Eriksson and Shanghai SIPG still fighting|
|MLS All-Stars 1 Arsenal 2: Premier League giants win late as Xhaka makes debut|
|Conte: I want aggression and intensity|
|Wimmer backs physical Janssen for Tottenham success|
|Klopp: I wouldn´t spend £100m on one player|