Niko Kovac's men just needed to match Borussia Dortmund's result at home to Fortuna Dusseldorf, but Lucien Favre's side ran out 3-2 winners, meaning the Bundesliga title will be decided on the final day of the season.
Bayern crafted the better opportunities in an even first half, but Peter Gulacsi rose to the challenge and twice kept Serge Gnabry at bay.
Goretzka's emphatic strike early in the second half was then contentiously wiped out due to offside against Robert Lewandowski and Leipzig held on to ensure Dortmund – two points adrift of the top – remain in the hunt next week.
Leipzig made a promising start and troubled Bayern a couple of times in the first 16 minutes, as Yussuf Poulsen shot wide of the left-hand post before Timo Werner saw a seemingly goal-bound effort crucially blocked.
Bayern gradually improved and Gulacsi produced a vital save to deny Gnabry from close range after Lewandowski's solo run and cross in the 29th minute.
Gnabry went close again just before the break from a tight angle, but again Gulacsi was there to block the winger's volley.
Bayern upped the ante again after the interval, with Kingsley Coman's rasping 25-yard drive testing Gulacsi.
The goalkeeper was unable to prevent Goretzka smashing home in the 51st minute after Ibrahima Konate's poor headed clearance, but luckily for Leipzig a VAR review saw the goal disallowed for the most marginal of offside calls against Lewandowski in the build-up.
Despite Bayern's relentless pressure towards the end they were unable to make the breakthrough, as Gulacsi managed to save a clever Franck Ribery flick and Lewandowski's 89th-minute free-kick went agonisingly wide of the bottom-right corner.
47' #BVBF95 1-1 Fink scores— Bundesliga English (@Bundesliga_EN) May 11, 2019
49' #RBLFCB 0-1 (VAR rules out 0-0)
53' #BVBF95 2-1 Delaney scores
59' #BVBF95 Fortuna miss a penalty
Twists and turns galore in the race for the title pic.twitter.com/pXNAP6EOxQ
What does it mean? Bayern to feel the pressure on the final day
Bayern will head into their final game of the season two points clear at the top, but Eintracht Frankfurt are still chasing a top-four finish and have more than enough ability to trouble them. All of the pressure will be on Kovac's men, and in a season that has seen Bayern show cracks, that is not necessarily a desirable position to be in.
Gulacsi a safe pair of hands
Few players truly shone on Saturday, but Gulacsi in the Leipzig goal certainly stood out, making several necessary saves in an assured display.
It was a difficult day on the whole for Lewandowski. Although a good run set up a first-half chance for Gnabry, he was otherwise quiet and dealt with well by Konate.