The Yankess' Aaron Judge motions to the dugout after hitting...

The Yankess' Aaron Judge motions to the dugout after hitting an RBI double, scoring Joey Gallo, in the fifth inning against the Blue Jays in Toronto on Sunday. Credit: The Canadian Press via AP/Jon Blacker

ST. PETERSBURG, Fla. — In the Yankees’ clubhouse after a given loss — home, where there haven’t been many this season, or away — the televisions are dark, the music turned off.

After Sunday’s 10-9 loss to the Blue Jays that kept the Yankees from a three-game sweep, the televisions were dark, but the music played, almost as if after a win.

And though players quietly went about their business of collecting their items and preparing for the early evening flight to Florida, the music didn’t seem out of place.

After all, the Yankees had won nine straight before the setback, which cost them a chance at matching the best start in franchise history. Still, the Yankees “settled” for the 49-17 record they brought into Monday night’s game against the Rays at Tropicana Field.

And it was a loss in which a bullpen that had been among the best in the sport all season had a rare hiccup, contributing to the blowing of an 8-3 lead as Miguel Castro allowed a sixth-inning grand slam to Lourdes Gurriel Jr. and Wandy Peralta surrendered a seventh-inning three-run homer to Teoscar Hernandez.

But during the course of any major-league season, losses such as those occur, and a little traveling music certainly seemed more appropriate than a funereal atmosphere for a team that nonetheless departed Canada with an 11-game lead in the AL East.

There was also this: After Hernandez’s blast made it 10-8, the Yankees still managed to throw a huge scare into a Blue Jays team desperate for a victory over the Yankees after being noncompetitive the first two games of the series.

Anthony Rizzo ripped the first pinch-hit homer of his career — in the eighth inning off lefthander Tim Mayza — to make it 10-9. The first baseman came up again in the ninth against Toronto closer Jordan Romano with two outs and runners on the corners.

Giancarlo Stanton had worked a one-out walk and Aaron Hicks singled with two outs. Rizzo, with lumps in the throats of the 44,395 at Rogers Centre — not to mention in the throats of players and coaches in the Blue Jays’ dugout — bounced out to end the game.

“Our guys don’t go away,” Aaron Boone said.

It was reminiscent of June 9 in Minneapolis, when Gerrit Cole, who started Monday night, lasted only 2 1⁄3 innings, but the Yankees hit four homers, including two by Joey Gallo, and stormed back to take a 10-7 victory.

“All we just kept telling Gerrit was, ‘We got you, we got you. We know we’re going to come back in this game,’ ” Gallo said afterward. “That’s the kind of offense we have, the kind of team we have.”

Said Rizzo: “I think we’ve just continued to prove to ourselves that it doesn’t matter what the situation is in the game, we’re never out of it. We are relentless and we’ll continue to fight to the last out . . . They took the lead, we punched back. We fell short but we were right there.”

The Yankees have backed up such talk all season, leading the majors in comeback victories with 19 (they had 44 all of last season).

“You gotta beat us. They come back with some huge at-bats to grab the lead and our guys don’t go away,” Boone said. “We got the tying and go-ahead runs there in the ninth. Rizz throws a great at-bat off of Romano working it to full, laying off of pitches. So I thought another great job by the guys of just competing.

“Even in a game we lost, I’m sure other side’s like, ‘We have to beat those guys.’ I was really pleased, after losing a big lead, with the quality of at-bats at the back end of the game against their closer and Mayza, who’s really tough on lefthanded hitters. Rizz comes off the bench and does that [the pinch-hit homer]. So we gave ourselves a chance in the eighth to get back in it and then in the ninth. Just really pleased with how the guys grinded all the way to the end.”

More Yankees headlines