NEW YORK — Brandon Lowe hit three home runs and the Tampa Bay Rays rolled to a 12-2 blowout of the Yankees on Saturday that prevented New York from clinching a playoff spot.

With a chance to pitch his team into the postseason, Yankees starter Jordan Montgomery instead was rocked for a career-worst seven earned runs in 2 2/3 innings. He gave up a pair of three-run homers to Lowe, who also went deep in the seventh against Michael King.

Even with the embarrassing defeat before a booing Yankee Stadium crowd of 41,648, New York could still punch its postseason ticket Saturday with losses by Toronto and Seattle. By the time the Yankees had finished their postgame interviews, though, the Blue Jays had built a huge lead late in their game against last-place Baltimore.

A victory in the scheduled regular-season finale Sunday against Tampa Bay would guarantee the streaky Yankees an AL wild card.

“We’ve got to win. It’s as simple as that,” veteran outfielder Brett Gardner said. “Here we are going into Game 162 not knowing what the future is.

“It’s not ideal. But it’s nice knowing that we still have a chance,” he added. “The way the season has gone, it kind of makes sense that it would come down to the very last day. Seems about right.”

New York is assured at least a tiebreaker game Monday that could put the team in the playoffs for the fifth straight season. But after dropping the first two games of this series, the Yankees no longer control their own destiny to host the wild-card game. Now they need a Boston loss to do so.

New York began the day with a one-game lead over the Red Sox for the league’s top wild card. Boston was playing at Washington.

“Just a bad day for us and we’ve got to get over it quickly,” Yankees manager Aaron Boone said.

Lowe batted in the eighth with an opportunity to match the major league record of four home runs in a game. He evaded a 93 mph fastball from Joely Rodriguez that was way inside, then grounded out to first base.

Lowe and Mike Zunino homered back-to-back off Montgomery (6-7) in the third to make it 7-1. Austin Meadows added a three-run shot in the seventh as the AL East champion Rays (100-61) reached 100 wins for the first time in team history.

Tampa Bay, which has already wrapped up home-field advantage throughout the American League playoffs, had never before been 39 games over .500.

Zunino, Randy Arozarena and Wander Franco had three hits apiece for the Rays, who outhit New York 19-4.

Luis Patino (5-3) worked two hitless innings for the win.

Montgomery’s shortest outing this season marked an untimely end to a strong stretch.

The left-hander had permitted no more than one run in three straight starts and nine of his past 11, going 3-1 with a 2.26 ERA during that span. He was 1-0 with a 1.65 ERA and 22 strikeouts over 16 1/3 innings in his past three outings and had allowed three earned runs or fewer in 15 of his last 16 starts since June 20.

“Nobody’s perfect. They’re going to happen,” he said. “Just got to be better next time.”

Lowe has gone deep in his past three games, and his career-high seven RBIs gave him 99 this season. He increased his career-best total to a team-leading 39 homers with his first three-homer game in the majors. It was his sixth career multihomer game and fourth this year.

Anthony Rizzo homered for the Yankees, and Gio Urshela had an RBI triple.

TRAINER’S ROOM

Rays: With manager Kevin Cash looking to rest 1B Ji-Man Choi and INF Joey Wendle, catcher Francisco Mejía made his first career start at first base.

Yankees: 3B DJ LeMahieu missed his second consecutive game with a sports hernia that will require offseason surgery, but the two-time batting champion will attempt to play through the injury in October. He received a cortisone injection Friday and the team hopes he can return to the lineup Sunday ... 1B Luke Voit probably will be sidelined for at least a couple of weeks with left knee inflammation. Voit, placed on the 10-day injured list Thursday, could potentially return later in October if the Yankees advance deep enough in the postseason, Boone said.

ROSTER MOVES

Rays: Recalled RHP Chris Mazza from Triple-A Durham and optioned RHP Louis Head, who stayed with the big league team on the taxi squad.

Yankees: Recalled infielder Andrew Velazquez from Triple-A Scranton/Wilkes-Barre and optioned reliever Albert Abreu to their top farm club. Velazquez started at shortstop and Urshela shifted back to third base, his natural position.

UP NEXT

RHP Michael Wacha (3-5, 5.26 ERA) pitches the regular-season finale Sunday for Tampa Bay. New York had not announced a starter — Jameson Taillon (right ankle) is an option after throwing a successful bullpen Friday. Gerrit Cole on three days’ rest could also be in the mix. “I don’t know. We’ll talk about it,” Boone said.