BOSTON — This one hurt.

The Yankees had it all set up for a signature 2016 win Friday night at Fenway Park when Masahiro Tanaka had a two-run lead with two outs in the seventh inning. Dellin Betances and Andrew Miller loomed. One more out was all Tanaka needed to get the game to the dynamic duo.

But Jackie Bradley Jr. lashed a tying two-run double off the Green Monster to electrify the crowd and end Tanaka’s night.

Even more shocking: Betances gave up a two-run home run to David Ortiz in the eighth, and the Red Sox went on to a 4-2 victory to drop the last-place Yankees to 8-13.

“Tonight especially hurts,” said Alex Rodriguez, who hit his 691st homer in the second.

The Yankees’ offensive woes continued as they managed only six hits, including A-Rod’s home run off a Green Monster light tower and an RBI single by Brett Gardner in the fifth to give Tanaka a 2-0 lead.

advertisement | advertise on newsday

Red Sox pitchers retired the final 13 Yankees batters. It was the 16th time in 21 games that the Yankees had scored three or fewer runs (they’ve gone 3-13 in those games) and the 11th time they had scored two or fewer runs (0-11). They have scored three or fewer runs in 14 of the last 16 games.

The Yankees entered the game with 15 hits in their last 119 at-bats with runners in scoring position. So of course the baseball gods made sure they had a runner in scoring position two batters into the game against lefthander Henry Owens when Jacoby Ellsbury walked and Gardner beat out a bunt single.

However, the Yankees were not ready to overcome their RISP woes just yet. Carlos Beltran grounded into a double play and Mark Teixeira flied to left.

Rodriguez led off the second with his fourth home run of the season and fifth hit in five consecutive at-bats for a 1-0 lead.

One out later, Starlin Castro tripled (Bradley misplayed what should have been a single to center) to give the Yankees another chance with runners in scoring position. But Chase Headley hit a fly ball to medium left and Brock Holt gunned down Castro at the plate to make the Yankees 0-for-3 with RISP.

Yankees videos

Finally, finally, the Yankees got their first hit in those situations in the fifth when Gardner grounded a two-out RBI single to right for a 2-0 lead. That would seem to be enough if Tanaka could get the ball to Betances and then Miller.

Unfortunately for the Yankees, Tanaka held the lead for only 6 2⁄3 innings. The Red Sox rallied on one-out singles by Travis Shaw and Holt and Bradley’s opposite-field double.

Joe Girardi had Betances and Chasen Shreve warming but chose to let Tanaka face Bradley because he had been pitching so well to that point. Bradley was 1-for-13 against Tanaka to that point, too.

“He had done a good job,” Girardi said. “He’s done a good job throughout on Bradley. His split had been really good tonight. He threw a split there that didn’t do much and he hit it off the wall.’’

Said Tanaka: “It’s that last out that I needed to get. That’s on me.”

advertisement | advertise on newsday

After Bradley tied it, Betances retired Mookie Betts on a fly ball to center to end the inning before giving up a one-out single to Xander Bogaerts and the first-pitch clout by Ortiz over the Monster in the fateful eighth. Before that at-bat, Ortiz was 0-for-7 with four strikeouts against Betances.

Said Rodriguez, “It’s good to know Dellin’s human.”

The Yankees didn’t win the game, but A-Rod won the odd quote of the night award with that one. There was nothing good about the final 2½ innings for the Yankees and nothing good about the outcome.