The Yankees' Aaron Judge is congratulated by teammates after hitting...

The Yankees' Aaron Judge is congratulated by teammates after hitting his second home run of the game during the eighth inning against the Blue Jays in Toronto on Monday. Credit: AP/Frank Gunn

TORONTO — Well before first pitch, the Yankees seemed to be playing a losing hand.

After a four-game series split with the AL East-leading Rays over the weekend at the Stadium, they rested two of their best hitters, Harrison Bader and DJ LeMahieu, on Monday night in the first of four games against the powerful Blue Jays.

Only 25¢ for 5 months

Unlimited Digital Access. Cancel anytime.

Already a subscriber?

TORONTO — Well before first pitch, the Yankees seemed to be playing a losing hand.

After a four-game series split with the AL East-leading Rays over the weekend at the Stadium, they rested two of their best hitters, Harrison Bader and DJ LeMahieu, on Monday night in the first of four games against the powerful Blue Jays.

Throw in the decision to use reliever Jimmy Cordero, who had never before started a game in the big leagues, as an opener — to be followed by the struggling Jhony Brito — and all signs pointed toward a loss, potentially an ugly one.

Instead, Cordero retired all six batters he faced, Brito was tremendous before tiring in the eighth, and Aaron Judge hit two of the Yankees’ three home runs in a 7-4 victory over Toronto in front of 28,810 at Rogers Centre.

Judge hit a solo homer to right-center and Willie Calhoun had a two-out, two-run shot to right-center in the first inning against Alek Manoah, and Judge added a 462-foot solo blast to centerfield with two outs in the eighth. It was the 30th multihomer game of his career and gave him 10 home runs in 117 at-bats in 33 games. He also walked three times and had three RBIs.

The Yankees (24-19), who have won nine of their last 13 games, had the Blue Jays (24-17) shut out going into the eighth, which was especially impressive given that Toronto had outscored the opposition 72-43 in winning 12 of its first 15 home games. Down 7-0, the Blue Jays scored four runs in the eighth to make it interesting, but Michael King got out of the inning and pitched a perfect ninth.

Judge’s second homer came three pitches after Aaron Boone was ejected by plate umpire Clint Vondrak for arguing a strike call on a low pitch that brought the count on Judge to 1-and-2.

As the dugout reacted to the low strike call, Judge held his hand up in an attempt to quiet everyone down. “There was a lot of chirping from our dugout, which I really didn’t like in the situation where it’s a 6-0 game,’’ he said. “I was trying to save Boonie by calling time out, like, ‘Hold up here, let me work here.’ . . . I said a couple of things to some guys in the dugout and especially after the game. Hopefully it won’t happen again.’’

Boone, the American League leader in ejections last season with nine, was tossed for the second time this season and gave a lengthy earful to Vondrak and first-base umpire James Hoye.

Said Boone, “I didn’t feel like I got that upset to warrant a throw-out. That’s why I got upset when he did throw me out . . . He [Hoye] stepped in as the crew chief there and I was just saying I didn’t feel like that was warranted, especially I felt like the other side berated him [Vondrak] pretty good at one point . . . I’ve got some experience getting thrown out, and tonight didn’t feel like it got to that level and pretty quick, so I was letting them know I didn’t think that was right.”   

The Yankees jumped on Manoah quickly. With one out, in the first, Judge — who entered the game 1-for-19 against him — blasted a 1-and-2 fastball in the upper part of the strike zone into the Yankees’ bullpen. With two outs, Gleyber Torres singled to left and Calhoun hit a two-run shot to make it 3-0.

“Over the course of the season, you’re going to go through your bumps and bruises,’’ Calhoun said, “but I’d definitely say that the last week or so, we’ve been clicking as an offense as a whole. It’s fun.”

Anthony Volpe, on fire since being moved down in the order, led off the fourth with a double down the leftfield line. Oswaldo Cabrera walked, Kyle Higashioka slashed an RBI single to right-center and Judge drew a bases-loaded walk for a 5-0 lead. Anthony Rizzo had an RBI double in the sixth.

Cordero, solid this season in relief, lowered his ERA from 2.81 to 2.50. “I wasn’t thinking too much,’’ he said. “Keep it simple, throw strikes, execute my pitches and everything will go well.”

Brito, 0-3 with an 8.14 ERA in his previous six outings, dominated the Blue Jays until the eighth, when he departed with a run in on Whit Merrifield’s RBI single, one out and the bases loaded. Ian Hamilton allowed an inherited runner to score to make it 7-2. Bo Bichette added an RBI single and Vladimir Guerrero Jr. doubled home a run (on a pitch he actually hit twice).

Judge said of Cordero/Brito: “It’s big-time, especially Jimmy going through the top of that lineup, that’s one of the best in the league right there, that one through five, one through six they’ve got over there. Him throwing up a couple zeros for us and then letting the offense work a little bit gave us a little sigh of relief.”