Yankees starting pitcher Clarke Schmidt walks to the dugout against...

Yankees starting pitcher Clarke Schmidt walks to the dugout against the Baltimore Orioles after the top of the first inning of an MLB game at Yankee Stadium on Tuesday. Credit: Kathleen Malone-Van Dyke

There was champagne at Yankee Stadium on Tuesday night, but it was sprayed in the visitors’ clubhouse, not the Yankees’.

The Orioles put a cork in the Yankees’ celebration of a would-be division clincher with a 5-3 victory that secured a playoff berth for Baltimore — thanks to a loss by the Twins.

But it delayed by at least one day the crowning of an AL East champion. The Yankees’ magic number still is one, so they still can clinch by beating the Orioles on Wednesday or Thursday.

“It’s disappointing,” said Aaron Judge, who hit his 56th home run. “On to the next game. We didn’t get it done today, but we have another opportunity tomorrow.”

The loss was made more frustrating by a baserunning miscue by Gleyber Torres in the seventh inning.

Trailing 4-2 with two out and runners on second and third base, Juan Soto singled home Alex Verdugo from third to make it 4-3.

Torres initially held at third base on Soto’s single, then tried to score when Soto ran to second. But the Orioles threw home and caught Torres in no-man’s land. He was out, 9-2-6-2-5-2-6.

Judge was on deck at the time, making the mistake that much worse.

“He was hustling the whole way,” Judge said of Torres, who had three hits in the game. “I think he wanted to score and got the stop sign and was kind of in no man’s land right there.

“When it comes down to it, stuff like that can’t happen. We can’t keep shooting ourselves in the foot with mistakes like that on the basepaths. It happens. We’ve got to move on and get ready for tomorrow.”

Boone said Torres thought Soto would be out at second and tried to protect him by coming off third base to pull the fielder away from second base.

Torres confirmed he was trying to “protect” Soto from getting thrown out at second by faking going home.

“In that situation, just protect,” Torres said. “I was a little in-between to home plate. I feel like I went a little bit late and they made me out . . . I feel like I have to be a little more aggressive.

“If I’m going to make that decision, go straight [to home plate]. It’s going to be my mistake. Just get ready for tomorrow.”

The Yankees (92-65) had won six of seven games coming into Tuesday.

The Orioles (87-70) took a 1-0 lead in the second inning on a single by Jordan Westburg, a double into the rightfield corner by Ryan O’Hearn and a run-scoring groundout to second base by Heston Kjerstad.

That all came against starter Clarke Schmidt, who otherwise seemed to have good stuff, striking out four Orioles in the first three innings.

The visitors took a 2-0 lead in the fourth when Anthony Santander walked, reached second on a wild pitch and scored on O’Hearn’s two-out, two-strike single to leftfield.

Judge led off the bottom of the fourth with a towering home run — his 56th this season — to leftfield on a 3-and-2 count to make it 2-1.

Santander’s home run off the rightfield foul pole in the sixth made it 3-1 and knocked Schmidt out of the game. Then Ramon Urias led off the seventh with a home run to right-center off Tim Mayza to make it 4-1.

The Orioles made it 5-3 in the eighth when Colton Cowser crushed a long home run to right off Ian Hamilton.

“This is the toughest division in baseball,” Judge said. “To be able to say we’re division champs would be great. But we’ll talk about it tomorrow.”

Notes & quotes: Reliever Jake Cousins, who went on the IL on Sunday with a right pectoral strain, said before the game that he hopes to start throwing in a few days and aims to return for the start of the playoffs. “That’s the goal,” he said. “Setting the date for Oct. 5.” Said Boone, “We’re optimistic. I think all the testing proved pretty good.” . . . The Knicks’ Josh Hart threw the first pitch, wearing a Yankees jersey with the No. 32 of his great uncle, Elston Howard . . . Former Yankee Bernie Williams played the national anthem on a guitar.