SAN FRANCISCO (CBS/AP) — In a winner-take-all matchup featuring Major League Baseball’s longest-running rivals, the San Francisco Giants fell to the Los Angeles Dodgers in a game that could’ve been scripted in Hollywood but was played to a capacity crowd in the city by the bay.

The Dodgers scored first and, to the dismay of Giants fans everywhere, last when Cody Bellinger singled with one out in the ninth inning to send Justin Turner across the plate for what proved to be the winning run.

Dodgers - Giants NLDS Game 5

Dodgers’ Cody Bellinger hits an RBI single to score Justin Turner in the ninth inning in Game 5 of the National League Division Series at Oracle Park Oct.14, 2021 in San Francisco. (Thearon W. Henderson/Getty Images)

The victory means the Dodgers will play the Atlanta Braves for the pennant, giving them a chance to advance to their fourth World Series in the past five years.

“We poured everything we could into this series and it took everything we had to beat these guys,” Dodgers manager Dave Roberts said.

Flores Checked Swing

Giants’ Wilmer Flores is called out on an apparent checked swing for the final out of Game 5 Oct. 14, 2021, in San Francisco. (AP Photo/Jed Jacobsohn)

The game ended with a controversial call that will be debated for decades. With a runner on, Max Scherzer struck out Wilmer Flores on a check-swing to finish off the Giants. First base umpire Gabe Morales rang up Flores on appeal but, on television replays, it didn’t appear he swung.

“The umpire said it was a swing so it was a swing,” Bellinger said.

The Dodgers rushed out of their dugout to celebrate on the Giants’ home field. Fans began throwing beer cans and debris onto the diamond in disgust.

“Super tough. Obviously, you don’t want a game to end that way,” San Francisco manager Gabe Kapler said. “There’s no need to be angry about that. I just think it’s a disappointing way to end. There are other reasons we didn’t win today’s baseball game, so that was just the last call of the game.”

Scherzer, the Game 3 loser who came from Washington at the trade deadline, closed out a best-of-five series certain to go down among the several classics these franchises have played — right up there with the 1951 and ’62 clubs that each matched up in three-game tiebreakers for the NL pennant that the Giants won each time.

Mookie Betts had the Dodgers’ initial three hits with singles at the top of the lineup before Corey Seager’s RBI double in the sixth as the Dodgers finally got to Game 1 winner Logan Webb.

Betts had a postseason career-high four hits and will lead the next step in the Dodgers’ title defense at Atlanta for Game 1 of the best-of-seven NLCS on Saturday night. Roberts expects Scherzer to be ready to start, saying, “that’s the plan.”

Dodgers at Giants NLDS Game 5

Giants pitcher Logan Webb, middle, meets on the mound with shortstop Brandon Crawford and catcher Buster Posey during the fourth inning of Game 5 of the National League Division Series against the Dodgers Oct. 14, 2021, in San Francisco. (AP Photo/John Hefti)

Webb pitched seven brilliant innings and allowed one run on four hits, striking out seven and walking one as he once more delighted a sellout crowd of 42,275 with their swirling orange rally towels and deafening “Beat LA!” chants.

The 24-year-old right-hander and two relievers shut out the Dodgers 4-0 here last Friday and Webb’s Sierra Elementary School in Rocklin held a day in his honor earlier this week.

Betts led off the game with a single but the Giants got out of it with an inning-ending double play and Webb faced the minimum through two.

Right-hander Corey Knebel opened for the Dodgers and gave up Buster Posey’s two-out double in the first, then pumped his fist striking out Brandon Crawford in a seven-pitch at-bat.

Dodgers - Giants NLDS Game 5

Giants’ Darin Ruf hits a home run against the Dodgers during the sixth inning of Game 5 Oct. 14, 2021, in San Francisco. (AP Photo/Jed Jacobsohn)

Camilo Doval plunked Justin Turner with one out in the ninth and Gavin Lux then singled before Bellinger delivered his most meaningful hit in a scrutinized season.

In the 24th and final meeting between these so evenly-matched rivals who knew everything about each other by this stage, it was only fitting they split at 12 apiece. The 107-win Giants edged the Dodgers for the NL West title on the final day, Los Angeles winding up one game back with 106 victories.

Both teams went into this game with 109 wins, including the playoffs.

“Best record in all of baseball and it was just great every time we played those guys, just bringing that rivalry back to life, really playing for relevance,” Roberts said.

SCULLY SAYS

Hall of Fame broadcaster Vin Scully, who retired following the 2016 season after 67 years calling Dodgers games, weighed in on the magnitude of this Game 5 matchup in the clubs’ storied histories.

“To my knowledge, tonight’s game between the (at)Dodgers and (at)SFGiants is the most important game in the history of their rivalry. With nearly identical records, and so much at stake, I believe this to be the case,” Scully posted on Twitter. “Many of you might consider the 1951 game for the NL pennant to be bigger. Perhaps, but that was more about the greatest moment with Bobby Thomson’s game-winning home run.”

© Copyright 2021 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report