NEW YORK (AP) – After three intense games between the New York Yankees and Los Angeles Dodgers in front of sellout crowds, Oswaldo Cabrera allowed himself to think ahead.

“It crossed in our minds this can be a good matchup in October,” the Yankees utilityman said.

New York beat the Dodgers 6-4 on Sunday night to avoid a three-game sweep as Trent Grisham hit a go-ahead, three-run homer in the sixth inning off Tyler Glasnow. Aaron Judge and Cabrera also homered for the Yankees, who have the American League’s best record at 46-21.

Los Angeles, which won the opener 2-1 in 11 innings and 11-3 on Saturday, tops the NL West at 41-26.

“Playing with this media attention, sold out, the energy – you feel it – a team that you potentially could meet in the World Series, is sort of a barometer,” Dodgers manager Dave Roberts said.

There have been 11 Yankees-Dodgers World Series meetings – four more than any other matchup – but none since 1981. Since Major League Baseball started interleague play in 1997, the teams have evenly split 22 regular-season games.

New York Yankees' Aaron Judge follows through on a home run against the Los Angeles Dodgers during the eighth inning of a baseball game, Sunday, June 9, 2024, in New York. (AP Photo/Noah K. Murray)

+3

New York Yankees’ Aaron Judge follows through on a home run against the Los Angeles Dodgers during the eighth inning of a baseball game, Sunday, June 9, 2024, in New York. (AP Photo/Noah K. Murray)

“You´re watching two really good teams out there, but it´s a long way to go,” Yankees manager Aaron Boone said.

There were five MVPs on the field in the series: Shohei Ohtani, Mookie Betts and Freddie Freeman for the Dodgers, and Judge and Giancarlo Stanton for the Yankees.

Ohtani went 2 for 13 with one RBI, Betts 3 for 12 with two RBIs and Freeman 2 for 10 with two RBIs.

Stanton was 0 for 14 with seven strikeouts and Judge 7 for 11 with three homers and five RBIs – giving him eight homers in 10 career games against the Dodgers.

“Judge is a man among boys,” Roberts said.

With the Dodgers in the Bronx for the first time since 2016, the three games drew 144,445 and doubled the Yankees’ home sellouts this season to six.

“Our fans are excited. I think that´s the biggest thing I noticed,” Judge said. “From the very first pitch all the way to the ninth inning, fans are out there screaming, yelling.”

Juan Soto missed the series because of left forearm soreness, but Boone said he could return as soon as Monday night in Kansas City. In his first season since the Yankees acquired him from San Diego, Soto is hitting .318 with 17 homers, 53 RBIs and a 1.027 OPS.

Judge is batting .305 with a major league-leading 24 homers, 59 RBIs and and a big league-1.139 OPS.

“A lot of the hype was coming from the outside. Inside we´re just playing ball,” Betts said. “A lot of things that we have to fix – situational hitting, I think that´s one of the main things. Just making sure we´re playing the game the right way and doing everything the right way because come postseason time we´re going to have to execute those things.”

LA was 7 for 30 with runners in scoring position over the three games and New York 3 for 21. The Yankees lead the major leagues with a 2.90 ERA and the Dodgers at 3.30 are second in the NL behind Philadelphia.

As often occurs in the postseason, a non-star player made a difference Sunday.

After Teoscar Hernández´s third home run and ninth RBI of the series gave the Dodgers a 3-2 lead against Luis Gil in the sixth, Grisham homered in the bottom half to put the Yankees ahead.

Fans had chanted “We Want Soto!” when Grisham came to the plate. After his drive about a dozen rows into the right-field seats, Grisham responded with a huge bat flip.

“Yes, I heard them,” he said of the chants, breaking into a wide smile.

“I was just happy that I was able to stay present in the moment and worry about myself and putting a good swing on one,” Grisham added.

Judge was irked by the chants.

“I think he made a good point, got his point across there with that homer,” the Yankees captain said.

When Grisham returned to the plate in the eighth, fans chanted: “We Want Grisham!”

“I liked those, too,” Grisham admitted with chuckle.

New York and Los Angeles each have 95 regular-season games left. To reach the World Series, each will have to win at least seven playoff games.

Roberts thought the series met expectations.

“You can see how Aaron used his bullpen, the fight that those guys had trying to salvage the series, the fight that we had even to the last out, the last inning,” he said.

Ohtani has never reached the playoffs. His competing for the title, especially against the Yankees, would attract attention to baseball around the world.

“This is one of those series in the regular season that is going to have that extra juice,” Boone said before the opener.

This appeared to be only an appetizer.

Los Angeles Dodgers' Mookie Betts (50) reacts after hitting a double against the New York Yankees during the fifth inning of a baseball game Sunday, June 9, 2024, in New York. (AP Photo/Noah K. Murray)
+3

Los Angeles Dodgers’ Mookie Betts (50) reacts after hitting a double against the New York Yankees during the fifth inning of a baseball game Sunday, June 9, 2024, in New York. (AP Photo/Noah K. Murray)

New York Yankees' Aaron Judge, left, celebrates with Trent Grisham (12) after scoring on his home run during the sixth inning of a baseball game against the Los Angeles Dodgers, Sunday, June 9, 2024, in New York. (AP Photo/Noah K. Murray)
+3

New York Yankees’ Aaron Judge, left, celebrates with Trent Grisham (12) after scoring on his home run during the sixth inning of a baseball game against the Los Angeles Dodgers, Sunday, June 9, 2024, in New York. (AP Photo/Noah K. Murray)