The Yankees made error after error, miscue after miscue in Game 2 of the ALDS.

And now, there’s no more margin for error.

A mistake-filled 5-2 loss to the Tampa Bay Rays at Tropicana Field on Monday night left the Yankees in an 0-2 hole and on the brink of elimination in the best-of-five playoff series.

The Yankees committed four errors — including three in the first inning — and failed to make several other defensive plays on a nightmarish night that just kept snowballing.

“A really rough night,” manager Aaron Boone said. “To say the least.”

Following a deflating 1-0 loss in Game 1 in which they managed only one hit, the Yankees turned to American League Cy Young Award favorite Cam Schlittler to be their stopper in Game 2.

In 17 road starts this regular season, Schlittler pitched to a 1.16 ERA — the fifth-best road ERA in MLB history. He entered Monday with a 0.87 ERA in three career playoff starts.

But the Yankees defense did the flame-throwing ace no favors.

Third baseman Ryan McMahon booted a chopper off the bat of Yandy Díaz, the Rays’ very first hitter.

Two batters later, Junior Caminero grounded into a force out, but second baseman Jazz Chisholm Jr. made an off-balance throw wide of first base as he attempted to turn a double play, allowing Díaz to score.

Catcher’s interference by Austin Wells erased a called third strike and further extended the inning, as did another off-line throw by Chisholm, which resulted in a force out but denied the Yankees any chance of doubling up Rays speedster Chandler Simpson.

That marked the first time in Yankees playoff history that they committed three errors in a single inning.

Still, Schlittler managed to limit the damage, escaping the bottom of the first after only one (unearned) run and 19 pitches.

“[Schlittler] battled. Obviously, picked us up all night,” Boone said. “It’s just hard to do that time after time. Too many, obviously, free outs out there, or free baserunners. … Cam did his job. We didn’t give him a good enough chance to really do his job.”

It was a similarly frustrating start for the Yankees’ offense, which continues to miss three-time AL MVP Aaron Judge, who is sidelined by a calf strain.

Rays starter Freddy Peralta — who, after struggling with the Mets, has thrived since an August trade to Tampa Bay — retired the first nine Yankee batters. Those included Spencer Jones, whose towering, second-inning fly ball struck a Tropicana Field catwalk and landed in center fielder Jonny DeLuca’s glove.

The Yankees finally broke through in the fourth when Ben Rice provided their first hit of the game — and their first run of the series — with a solo homer to tie the score, 1-1.

They continued to put pressure on Peralta from there, chasing him with two runners on and two outs in the fifth. Left-handed reliever Cam Booser walked Rice to load the bases, and Cody Bellinger nearly delivered the big hit that’s eluded the Yankees when he drilled a drive to deep center field.

But DeLuca caught Bellinger’s 405-foot screamer on the warning track, preserving the tie and leaving the Yankees with another gut punch.

It all unraveled for the Yankees from there.

After back-to-back hits against Schlittler to begin the fifth, the Rays took a 2-1 lead when an aggressive Jonathan Aranda scored from third base on a slow groundout by Liam Hicks with the infield in.

Caminero then scored on a slow roller off the bat of Simpson that rookie shortstop George Lombard Jr. failed to field. That play was deemed an error before the official scorer changed the ruling.

After Brent Headrick replaced Schlittler, the 21-year-old Lombard committed an actual error — this time on a wide throw — with two outs. Brooklyn-born Richie Palacios followed with a two-run single to put the Rays up, 5-1.

“It obviously sucks, and it’s not the position we want to be in,” Lombard said. “We made it hard on ourselves, but it’s baseball. We know anything can happen. We’re going to prepare for Game 3, and [I] still have confidence in this team.”

Schlittler was charged with four runs, but only two earned, over 4.1 innings on 76 pitches. Normally a strikeout machine, Schlittler finished with just two against the contact-oriented Rays, who made him work all night.

The only playoff game with more Yankee errors was Game 2 of the 1976 ALCS, when they committed five.

“I’m not disappointed in our defense,” Schlittler said. “I’m not disappointed in the offense. I’m really just disappointed in myself. That’s baseball, and those things are going to happen, but I’ve got to be able to work through those. I wasn’t able to do that today.”

All of the Yankees’ offense came from Rice, who added a solo home run in the eighth, giving him four homers and eight RBI this postseason.

Monday’s defeat followed a Game 1 loss on Saturday that also featured a costly, self-inflicted mistake. After Austin Wells broke up Drew Rasmussen’s no-hit bid with two outs in the eighth, the Yankees catcher was thrown out trying to stretch a double into a triple.

The series now shifts to the Bronx, where the Yankees will need to take Games 3 and 4 in order to force a winner-take-all Game 5 back in St. Petersburg, Fla.

Max Fried is scheduled to start Game 3 on Wednesday night. Fried hurled six innings of one-run ball against the Boston Red Sox last week in the Wild Card round.

The Rays are set to counter with 36-year-old right-hander Nick Martinez, a first-time All-Star who went 15-6 with a 3.10 ERA.

To advance to the ALCS, the Yankees will have to become the 11th team in MLB history to rally back from an 0-2 deficit in a best-of-five series. The 2017 Yankees were the last team to achieve the feat with a comeback against Cleveland in that year’s ALDS.

“We’ve responded all year to difficult times, and we’ve got to do that again,” Boone said. “We’ve got to get ourselves up off the mat.”