Yankees pitcher Gerrit Cole (45) reacts after the seventh inning...

Yankees pitcher Gerrit Cole (45) reacts after the seventh inning during Game 4 of the American League Division Series against the Royals at Kauffman Stadium in Kansas City on Thursday, Oct. 10, 2024. Credit: Newsday/Thomas A. Ferrara

KANSAS CITY, Mo. — The Yankees are in the American League Championship Series for the fourth time in the last eight years, and this time, longtime October nemesis Houston won’t be there to stop them.

Behind seven terrific innings from Gerrit Cole, perfect relief from Clay Holmes and Luke Weaver and just enough offense — highlighted by a second straight standout performance from Giancarlo Stanton — the Yankees closed out the Royals with a tense 3-1 victory on Thursday night in front of 39,012 at Kauffman Stadium.

The Yankees will host either the Guardians or Tigers — the fifth and deciding game of that series will be played Saturday in Cleveland — in Game 1 of the ALCS on Monday night.

“It means everything,” Aaron Judge, thoroughly soaked with champagne and beer after a boisterous clubhouse celebration, said after going 1-for-2 with a double and two walks.

“Since I’ve been here with the Yankees, we haven’t secured a pennant. The group that we have, how special this is, just excited for this opportunity. It’s going to be something special.”

Judge debuted in 2016 and his first full season was 2017, when the first of three ALCS losses to the Astros occurred, with the others coming in 2019 and 2022.

The Yankees’ series victory, coupled with the Mets (managed by former Yankees bench coach Carlos Mendoza) beating the Phillies in their NLDS, kept alive the city’s hopes for a second Subway World Series, the first coming in 2000.

“It’s going to be definitely a fun time in New York, man,” Judge said. “They’re having a great season, and it’s going to be fun to look forward to down the road, [maybe] getting a chance to face them again.”

First the Yankees had to put away the Royals, a young, athletic team that stared down the Yankees in all four games, having a chance to win all of them. The Yankees earned their three wins by a total of four runs.

They batted only .220 in the series (28-for-127) to the Royals’ .237 (32-for-135) but drew 27 walks to the Royals’ seven.

Just as Judge finished the series 2-for-13 with four walks and five strikeouts, Royals star Bobby Witt Jr. went 2-for-17 as the Yankees’ pitching mostly controlled Kansas City all series.

“I thought we played a real clean brand of baseball and won some games in different ways, whether it was the pitching, whether it was the defense making a play, whether it was heavy, long at-bats that grinded them down a little bit,” Aaron Boone said. “A good series against a good club.”

Kansas City hit eight balls of at least 100 mph off Cole in Game 1, a night in which he wasn’t super-sharp. Though the Royals made more hard contact as Thursday night wore on, they never really got to Cole, who allowed one run, six hits and no walks and struck out four. Tommy Pham went 3-for-3 against him and the rest of the Royals were 3-for-29 in the game.

Holmes pitched a 1-2-3 eighth and Luke Weaver struck out two in a 1-2-3 ninth for his third save of the series.

“Fired up,” said Cole, soaked from head to toe. “Had a couple IPAs with the boys, sprayed some champagne. This is the greatest.”

Juan Soto, Gleyber Torres and Stanton each had an RBI single in the game, and it took the Yankees all of three pitches to give Cole the lead for good. Torres lasered Michael Wacha’s first pitch of the night into the gap in left-center for a double. Soto then grounded an RBI single to make it 1-0.

The Yankees made it 2-0 in the fifth on Torres’ RBI single and 3-0 an inning later when Judge led off with a double and scored on Stanton’s 116.9-mph single up the middle against a drawn-in infield.

The benches cleared in the sixth as the enmity that slowly built throughout the series between the teams boiled over. Maikel Garcia led off with a single and Michael Massey scorched a grounder to first, where Jon Berti stepped on the bag before firing to Volpe at second. The shortstop put a hard tag on the sliding Garcia — intentionally or unintentionally, depending on one’s perspective, putting his right forearm in Garcia’s chest in an attempt to move him further from the bag — then tapping him again with his glove.

Volpe patted Garcia again after the out call and Garcia began walking to the dugout before turning around after Jazz Chisholm Jr., roaming over from third, appeared to say something to him. As Garcia walked back toward second, Volpe dismissively waved him away and the benches soon cleared, though it turned out to be nothing more than the usual grabbing and jawing before order was restored.

It did seem to fire up the Royals, who got a single from Witt and an RBI double by Pasquantino that made it 3-1.

“The stakes are high and everyone’s playing hard, everyone’s trying to win,” said Volpe, who went 3-for-12 with four walks overall and hit the ball hard pretty much all series. “They’re playing for their season. He went in hard but we’re always going to stand up [for ourselves].”

Pham singled with two outs in the seventh and Kyle Isbel missed a tying homer by inches, flying to Soto at the base of the rightfield wall. Cole’s reaction as the ball headed toward the wall made it clear that he knew he had narrowly escaped disaster.