BOSTON — Joe Girardi had the Red Sox right where he wanted them. Or so he thought.

The Yankees’ manager brought in Dellin Betances to get the final out of the seventh inning against Red Sox catcher Christian Vazquez on Sunday night in a tie game at Fenway Park.

Girardi didn’t have to make the move. The Red Sox had a man on first, but reliever Ivan Nova had just gotten the second out of the inning.

ColumnLennon: A-Rod a one-man wrecking crew at FenwayDataA-Rod's career home runs

But Girardi had worked hard to get the Yankees to the Betances/Andrew Miller portion of the evening. He wanted to go with his best.

Betances’ first pitch was a 97-mph fastball — and Vazquez launched it clear over the Green Monster and onto Lansdowne Street for a tiebreaking two-run homer as the Red Sox swept the three-game series, 8-7.

Could Girardi have simply stayed with Nova? “I could have,” he said. “But, I mean, it’s Dellin Betances.”

advertisement | advertise on newsday

It was a tough weekend for Betances. In the eighth inning on Friday night, he allowed what proved to be a game-winning two-run home run by David Ortiz, also on the first pitch. That one was a curve.

It was Vazquez’s first home run of the season and second of his career. It also was his first two RBIs of the season.

The Yankees (8-15) lost their fifth in a row and 13th in 17 games. The loss went to Nova (1-1), but Betances took the blame. “I’ll take the loss,’’ he said. “I feel like it was my fault.”

Yankees videos

“Dellin’s probably the least of my worries,” Girardi said. “Dellin’s too good not to get back on track.”

Particularly frustrating for the Yankees was that they scored six runs in the first 4 1⁄3 innings against Boston’s $217-million lefty, David Price. Should have been enough, right? But Nathan Eovaldi coughed up two leads, leaving the score tied at 6 going to the bottom of the seventh.

“It doesn’t matter how you lose or what the score is,” Girardi said. “Losing stinks. We’re in the business of winning games and we’re not doing it right now. That’s frustrating.”

Alex Rodriguez hit a two-run homer and two-run double off Price (4-0), who went seven innings. The Yankees had four hits in their first six at-bats with runners in scoring position, which had been a nagging problem of late.

The Yankees came in with 16 hits in their last 126 at-bats with RISP. They went 8-14 in April, scored the fewest runs in baseball (74) and hit an MLB-worst .189 with RISP.

advertisement | advertise on newsday

“It’s extremely frustrating,” Rodriguez said. “We felt like we had one in the bag on Friday night and this one as well. Hopefully we can build on our offensive approach tonight.”

Girardi decided to play both lefthanded-hitting Jacoby Ellsbury and Brett Gardner against Price, who had held lefties to a .111 average (2-for-18) this season. They were the only two lefties in the lineup as Brian McCann and Didi Gregorius did not start.

Girardi’s lineup machinations worked because Ellsbury got on base three times in the first five innings (two doubles and a hit-by-pitch) and scored twice and the middle-of-the-order hitters did their jobs. It’s not a complicated formula, but it’s one that had been eluding the Yankees for most of the season.

With the Red Sox leading 1-0 in the third, Ellsbury smacked an RBI double inside the first-base bag to tie it.

One out later, A-Rod jumped on Price’s first pitch and drove it to left-center and over the Monster for his fifth home run of the season and second of this series. Rodriguez’s 692nd career home gave the Yankees a 3-1 lead and their first inning of at least two runs since April 9.

advertisement | advertise on newsday

But the Red Sox scored three in the bottom of the third to go ahead 4-3. Hanley Ramirez had a two-run single and Brock Holt added a two-out RBI single.

The pattern repeated itself in the fifth. Rodriguez hit a booming two-run double high off the wall in left-center and scored on Mark Teixeira’s single for a 6-4 lead. But Eovaldi, who threw six no-hit innings against Texas in his last outing, gave up a tying two-run homer to Travis Shaw in the bottom of the fifth.

“Shutdown innings are probably the most important innings,” Girardi said. “And we weren’t able to do that tonight.”

The Yankees closed to within 8-7 in the eighth when Starlin Castro doubled and scored on a wild pitch by Koji Uehara. But they went down 1-2-3 with two strikeouts against Craig Kimbrel (eighth save) in the ninth and go into today’s off-day seven games under .500 for the first time in Girardi’s nine seasons as their manager.

Asked if he thinks it might be time to make some changes, Girardi said: “I don’t know where you necessarily go. These guys in the room have to get it done.”

The same guys who are 8-15?

“That’s not a good start,” Teixeira said. “We’re used to winning a lot of games here. We’ve got to get back to the winning ways. I think everyone believes in each other in here. We’ve just got to play better. That’s just the way it is. It’s a small sample size right now. But it’s getting bigger.”