Yankees manager Aaron Boone, second from left, and Orioles major...

Yankees manager Aaron Boone, second from left, and Orioles major league field coordinator/catching instructor Tim Cossins, left, argue after players cleared the benches during the ninth inning of a game Friday in Baltimore. Credit: AP/Stephanie Scarbrough

BALTIMORE — A rivalry that gradually has heated up the last couple of seasons boiled over in the ninth inning of the Yankees’ 4-1 victory over the AL East-leading Orioles on Friday night at Camden Yards.

With rain falling heavily, the benches cleared with one out in the ninth shortly after Yankees closer Clay Holmes hit the Orioles’ Heston Kjerstad in the right earflap of his batting helmet with an 0-and-2, 97-mph sinker.

As a Baltimore trainer and Orioles manager Brandon Hyde went out to check on Kjerstad, Hyde glared at and appeared to shout something at Holmes, who took several steps toward the plate before being intercepted.

After Kjerstad made it to first, Hyde started charging toward the Yankees’ dugout. Catcher Austin Wells tried to intercept him and within seconds, the dugouts and bullpens had emptied.

Afterward, the overall feeling in the Yankees’ clubhouse was that they understood Hyde’s anger, even as Holmes’ teammates gave him a full-throated defense that the wayward pitch in no way was intentional.

“He’s been a great manager for them for quite a few years and he always has his guys’ backs,” Aaron Judge said. “He’s going to stand up in any situation like that for his team. I have a lot of respect for him and what he does. If there’s any moment to stand up, it’s [there].”

Gerrit Cole, who shrugged off some early command issues and ended up allowing one run, five hits and one walk in six innings in which he struck out seven, said: “Anybody who was out there knows it was tough to grip the baseball tonight.”

That said, Cole added: “Their guy got hit in the head. Understandable that Brandon’s [angry] and he’s defending his players.”

Said Holmes: “You’re never trying to hit somebody in the head up high like that. Hope Heston’s OK from that. Just one of those things where conditions weren’t great and I was trying to throw a front-door sinker there and it just cut. It ran up and in on him. Definitely wasn’t trying to hit him.”

Holmes said he started making his way to the plate to check on Kjerstad. “I was trying to tell Heston I wasn’t trying to do it, hoped he was all right,” he said. “Saw Hyde mouthing some stuff. Some people [in the Yankees’ dugout] didn’t like that and things got heated.”

Wells — who had just taken over for Jose Trevino, who had doubled twice, scored twice and driven in a run before suffering what Aaron Boone said might be a quadriceps injury — initially was the one trying to keep Hyde from reaching the Yankees’ dugout.

“He was upset. He’s protecting his player,” Wells said. “He was hot in the moment, just protecting his guy.”

Hyde, who likely will face disciplinary action from Major League Baseball, was ejected. After several minutes, the field was cleared, play resumed and Holmes retired the next two batters to earn his 21st save and bring the Yankees (57-39) within one game of the Orioles (57-37).

The Yankees entered the game at 6-17 in their previous 23 games. The Orioles, who have scored one run in their last 33 innings, have lost four straight and are 12-13 since June 15.

The events of the ninth completely overshadowed what preceded it.

Cole, with his share of ups and downs in four previous starts since coming off the injured list, was electric, featuring a fastball that routinely hit 98 mph and sharp breaking pitches. The Yankees managed seven hits, including Judge’s MLB-leading 33rd homer, and eight walks, including four by Judge and three by Gleyber Torres. Trevino had an RBI double and scored on Jahmai Jones’ single in the second and Juan Soto added a two-out RBI single in the ninth.

That Cole provided some length was not insignificant. Boone said before the game that he had a “taxed” bullpen, as the unit needed to finish off the final 4 2⁄3 innings of each of the two previous games against the Rays.

On Friday night, Tommy Kahnle pitched a scoreless seventh and Luke Weaver threw a scoreless eighth in getting the ball to Holmes — and it wasn’t long before the benches emptied.

The slumping Anthony Volpe, in a 21-for-125 (.168) slide in his previous 29 games, slashed a single to right to spark a two-run second. The second-year shortstop went all the way to third when Anthony Santander misplayed the ball for a two-base error. Trevino followed with an RBI double to left and Jones banged an RBI single up the middle to make it 2-0.

Ramon Urias’ two-out RBI triple in the bottom of the second made it 2-1 and Judge gave the Yankees a 3-1 lead in the third with his 397-foot homer to left-center on an 0-and-2 curveball.

Judge hadn’t had an extra-base hit and hadn’t driven in a run in the previous eight games, going 4-for-31 for a .129/.229/.129 slash line. Before that, he had hit 26 homers and driven in 64 runs in his previous 50 games.

Soto’s RBI single in the top of the ninth gave the Yankees an important insurance run, yet another aspect of the game shoved to back-burner status given the events in the bottom half.

“I understand him coming out, being hot,” Boone said of Hyde. “One of your guys gets hit like that, it’s scary. I understand that. Glad it didn’t get too carried away and hoping that Kjerstad’s OK.”

More Yankees headlines

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 5 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME ONLINE