Will Warren of the Yankees pitches during the first inning against...

Will Warren of the Yankees pitches during the first inning against the Minnesota Twins at Yankee Stadium on Monday. Credit: Jim McIsaac

Ah, the Twins.

Just when the Yankees needed them.

Because in good times, bad times — and, really, pretty much all of the time — in the last nearly quarter century, the Twins could be counted on as an elixir for Yankees’ wins.

They dutifully served that purpose on Monday night.

Behind 6 2⁄3 mostly dominant innings from Will Warren and solo homers by Cody Bellinger, Giancarlo Stanton, Ben Rice and Jazz Chisholm Jr., the Yankees beat the Twins, 6-2, in front of 36,744 at the Stadium.

“Just a really clean game all-around,” said Aaron Boone, sounding almost relieved as his club, 20-31 since June 13 coming into the night, has not had enough of those in that stretch.

The Yankees (63-56), who moved within six games of idle Toronto in the AL East and inched one full game ahead of idle Cleveland for the league’s third and final wild-card spot, improved to 124-44 against the Twins since 2002, that number including a 16-2 mark in the six postseason series between the clubs during that span.

“We’re 1-0 against them this year,” Boone said with a shrug of the Yankees’ dominance over the Twins. “Just one of those things.”

Warren (7-5, 4.34), who struck out five of the first six batters he faced, allowed two runs and three hits in his 85-pitch outing. Warren, who did not walk a batter and struck out seven, became the first Yankee starter to complete six innings since he did so against the Rays on July 30.

When Max Fried lasted just five innings in Sunday’s loss to the Astros, it marked the 10th straight game in which a Yankees starter didn’t get past the fifth inning, a streak that further taxed what for almost two months has been a taxed bullpen, even with the three new additions at the trade deadline.

“As a starting rotation in general, we take pride in going six or more innings every time,” said Warren, now 2-1 with a 2.84 ERA over his last seven starts. “Lately that hasn’t been the case, so it was nice to go out there and give us length.”

Warren has allowed two runs or fewer in 17 starts this season, tied for second-most in the American League. Only the Red Sox’s Garrett Crochet has more (19 starts).

The Twins, who sold just about everyone in uniform except their coaching staff at the deadline, scored their runs on solo homers by Byron Buxton and Trevor Larnach. The latter’s two-out blast in the seventh pulled the Twins (56-62) within 3-2. But Trent Grisham and a slumping Aaron Judge had RBI singles in a two-run bottom half that gave the bullpen a cushion.

After retiring the final batter of the seventh, Luke Weaver struck out two in a perfect eighth. Following Chisholm’s 20th homer of the season in the bottom of the eighth, David Bednar entered in a non-save situation in the ninth and struck out two in a 1-2-3 inning.

Twins righthander Zebby Matthews, who came in 3-3 with a 5.17 ERA, allowed three runs and six hits in 5 2⁄3 innings, striking out nine and walking one. The three runs came on the Bellinger, Stanton and Rice homers.

Bellinger’s 21st homer — and 15th at Yankee Stadium — in the first made it 1-0.

Stanton’s blast gave him 440 career homers (he’s the active home run leader) to send him past Paul Konerko and into a tie with Jason Giambi for 44th all-time. Stanton and Rice went back-to-back in the third to give Warren a 3-0 lead.

“Every start back there just adds to the confidence,” said Rice, who got another start at catcher for the still-skidding Austin Wells and went 2-for-4. “Each one just feeling more confident being able to handle a pitching staff being able to call games effectively.”

Warren said the back-to-back shots gave a palpable jolt for a club sorely in need of one in recent weeks.

“I think we’ve been needing that spark,” Warren said. “We’ve been playing flat I feel like, and we jumped out there with the Bellinger home run and the obviously we went back-to-back.

“We got a spark of energy, and it was like, ‘all right, this is how we’re supposed to play baseball.’ The past month hasn’t been how we’re supposed to play baseball. We’ve had a gut punch lately, and it was nice to get out there and play baseball the way we’re supposed to.”

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 6 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME