LOS ANGELES -- The Los Angeles Dodgers found themselves in a familiar position Tuesday night: needing a late-inning spark to overcome a stubborn Kansas City Royals squad. They got it in the 10th inning, when Max Muncy ripped a single into the right-center gap, scoring Shohei Ohtani and giving the Dodgers a 5-4 walk-off win at Dodger Stadium.

Ohtani, who began the extra inning as the automatic runner on second, watched Muncy launch a Lucas Erceg offering into the outfield. The ball landed safely, and Ohtani sprinted home, capping a night where he went 0-for-5 with two strikeouts but still managed to be the winning run. For Muncy, it was a moment of redemption after a quiet game at the plate, and he was mobbed by teammates as the crowd roared.

The game was a back-and-forth affair, with both teams trading blows. The Dodgers tied it 4-4 in the bottom of the eighth when Mookie Betts, who had doubled earlier, came through with an RBI single off reliever Steven Cruz. That erased a 4-3 deficit that the Royals had built in the top of the same inning, thanks to a costly error by Dodgers outfielder Andy Pages.

With the Royals trailing 3-1, they mounted a rally against reliever Evan Phillips. Nick Loftin walked, then Bobby Witt Jr. singled, followed by Jac Caglianone and Salvador Perez each driving in runs. The key blow came when Carter Jensen hit a fly ball to center field. Pages appeared to have it in his glove, but he dropped it on the exchange, and the ball rolled to the wall. Caglianone scored from second, giving Kansas City a 4-3 lead. It was a tough break for Pages, who had been solid defensively all season.

Earlier, the Dodgers had built a 3-1 lead behind a strong start from Blake Snell, who was making his return from elbow surgery. The left-hander looked sharp, striking out seven of the first 10 batters he faced. He allowed a run in the fourth on a sacrifice fly by Perez, but that was all. Snell finished with six innings, three hits, one earned run, and two walks, throwing 85 pitches. His performance was a welcome sight for a Dodgers rotation that has been beset by injuries.

Michael Wacha, the Royals' starter, was solid if not spectacular. He went 6 2/3 innings, giving up three runs on seven hits with five strikeouts. The Dodgers got to him in the third when Alex Call poked a 3-2 pitch down the right-field line, scoring Betts, who had doubled and moved to third on a flyout. An inning later, pinch-hitter Teoscar Hernandez doubled to make it 3-1.

The Royals bullpen, particularly Erceg, could not hold the lead in the 10th. Seth Halvorsen, making his Dodgers debut, pitched a perfect top of the 10th to earn the win. The game was a testament to the Dodgers' resilience, as they have now won several games in walk-off fashion this season. The Royals, meanwhile, will look to bounce back in the series finale Wednesday, with left-hander Daniel Lynch IV facing Dodgers lefty Eric Lauer.