LOS ANGELES — Three years ago, Jack Flaherty was in the stands at the World Series, along with fellow big leaguer Lucas Giolito, watching their former Harvard-Westlake High teammate Max Fried pitch for the Atlanta Braves.

As Flaherty looked back on that this week, he admitted to mixed feelings in that game.

“It’s a funny feeling watching that because you’re excited for one of your best friends and you’re incredibly happy for him,” Flaherty said. “Also at that same moment you’re a competitor and you want to be in that situation, you want to be on the field.”

He got his chance on Friday night, starting Game 1 of the World Series. Although Flaherty left the mound with a one-run deficit, he nonetheless delivered the kind of start the Dodgers needed.

“Jack pitched his tail off,” Dodgers manager Dave Roberts said. “He made one bad pitch, but he pitched great.”

Flaherty gave up a two-run homer to Giancarlo Stanton on his 90th and final pitch of the night, with one out in the sixth inning, but that was all he allowed. He struck out six and walked one.

“I thought he pitched really well,” catcher Will Smith said. “Just one mistake, the Stanton little backup curveball. Other than that, he pitched really, really well.”

The Dodgers had lost two of Flaherty’s three previous starts this postseason, including an ugly performance in Game 5 of the National League Championship Series against the New York Mets.

In that game, Flaherty gave up eight runs in three innings. Afterward, manager Dave Roberts said that Flaherty had been “under the weather.”

Clearly, he had gotten over whatever was ailing him against the Mets.

Flaherty’s average fastball velocity during the regular season was 93.3 mph, and it was down to 91.4 mph against the Mets.

Also, Flaherty did not get a single whiff on 16 knuckle curves that drew swings from Mets hitters.

Against the Yankees, Flaherty’s average fastball was up to 93.6 mph, and the Yankees whiffed on 12 of their 17 swings at the his knuckle curve.

“It was definitely crisper,” catcher Will Smith said of Flaherty’s stuff, compared with the previous game against the Mets. “Putting the ball in good spots. Executing pitches. Definitely a lot better. Kind of like the first game of the NLCS.”

Flaherty pitched seven scoreless innings in Game 1 against the Mets.

Before he took the ball against the Yankees, he acknowledged that he was going to be a facing a dangerous lineup full of hitters who don’t swing at pitches out of the zone, and can hammer the ones in the zone.

The most dangerous hitter of them all is Aaron Judge, the likely American League MVP.

Flaherty struck him out three times.

Juan Soto, who hits before Judge, singled and walked in three trips against Flaherty. He was on base when Stanton hit the two-run homer that put the Yankees up 2-1 in the sixth.

“It’s just you’ve got to go out there and execute your pitches, and you’ve got to get them out in the zone,” Flaherty said on Thursday. “You’ve just got to keep making pitch after pitch after pitch and not really give in. And just continue to execute, continue to go one pitch after another and not — you don’t really group them all together each pitch. You’ve got to take it one pitch at a time. Once that one’s done, you move on to the next one and move on to the next one.

“The more you can slow things down and the more you can truly focus on the process of each and every pitch and what’s going on, I think the better spot you end up being in.”