NEW YORK — Just when it appeared Aaron Judge and the New York Yankees were right back in this World Series, they all but handed away the trophy.

An epic meltdown of defensive miscues, beginning with Judge’s embarrassing error in center field, helped the Dodgers rally in a five-run fifth inning that tied the score at 5.

Young shortstop Anthony Volpe and ace pitcher Gerrit Cole also committed costly mistakes. New York’s bullpen squandered a one-run lead in the eighth, and the Dodgers held on for a 7-6 victory Wednesday night in Game 5 that wrapped up their eighth championship and second in five years.

Finally back in their first World Series since 2009, the Yankees didn’t last long.

It was the latest autumn failure for baseball’s most successful franchise — one that used to own October.

Not anymore. Not lately, at least. And in the Yankees’ universe, 15 years is a long time between titles.

On deck, an offseason of uncertainty as New York tries to retain free agent slugger Juan Soto, who is expected to have several eager suitors and command a massive contract.

After losing the first three games to the Dodgers, the Yankees won 11-4 in Game 4 behind Volpe to prevent a sweep. That left them looking to become the first of 25 teams that fell behind 3-0 in the World Series to force a Game 6, which would have been back at Dodger Stadium.

And they got off to a rollicking start, too, with back-to-back homers by Judge and Jazz Chisholm Jr. in the first inning. Giancarlo Stanton went deep leading off the third, and the Bronx Bombers had a 5-0 cushion.

Cole cruised through four hitless innings, pitching around a leadoff walk in the fourth with the help of a remarkable catch by Judge as he crashed hard into the left-center fence.

California, here we come, right?

Wrong.