BOSTON — The talk beforehand was almost exclusively about the pitcher the Yankees were facing Thursday night and not the one they were starting.

“He’s off to a great start, striking a lot of people out and he’s held his opponents down,” Joe Girardi said of Boston lefthander Chris Sale. “I mean, he’s got really good stuff.”

All true.

And Thursday night, he was outpitched by Masahiro Tanaka.

The righthander, whose first three starts produced a disproportionate amount of angst, was brilliant for a second straight outing, pitching a three-hitter in a 3-0 victory over the Red Sox at Fenway Park.

As pitching coach Larry Rothschild put it afterward: “We’re comfortable with him facing anybody.”

advertisement | advertise on newsday

Tanaka, who improved to 3-1 with a 4.20 ERA (he’s allowed one run in his last 16 innings), struck out three and did not walk a batter in his fifth career complete game and first since Aug. 15, 2015 at Toronto.

“Against that lineup, in this ballpark,” said Girardi, in his 10th season managing the Yankees, “that’s as good [a performance] as I’ve seen.”

Tanaka retired the last 14 batters he faced in a game that took 2 hours, 21 minutes.

“I knew that we were facing a good pitcher,” he said through his translator. “I knew how important one run could be.”

It was a two-game series (Tuesday’s game was rained out) that could not have gone much better for the Yankees (13-7), who have won 12 of their last 15. Against the preseason AL East favorite, the Yankees came away with a sweep, outscoring the Red Sox, 6-1.

Yankees videos

“I knew it was going to be a battle, Chris Sale’s doing some good things over there,” Yankees catcher Austin Romine said. “But you know what? We have a pretty good team here.”

Sale entered the game with a 0.91 ERA and an MLB-leading 42 strikeouts and added 10 in eight innings Thursday. He allowed three runs (two earned) and eight hits. He struck out seven of the first 10 batters he faced, leading Girardi in the dugout to wonder: “Oh, boy. How many is he going to have tonight?”

But the Yankees chipped away, breaking through in the fourth against Sale, who is 4-1 with a 1.17 ERA in 10 career appearances against the Yankees.

Aaron Hicks led off with a line single to right, improving to 5-for-14 in his career against Sale at that point. Hicks went to second on Chase Headley’s hard groundout back to the pitcher. Matt Holliday, mired in a 2-for-28 slump, stepped in and when he swung and missed at a 1-and-1 slider, the ball got away from Sandy Leon for a passed ball allowing Hicks to reach third. Holliday fought back from a 1-and-2 count, eventually lining a slider to left for sacrifice fly that made it 1-0.

“It’s tough because you have to honor his 96, 97 mph fastball but he’s also got the really good breaking ball and that changeup he’ll throw,” Holliday said. “You can’t come off the fastball and hope you see the breaking ball in time to put it in play.”

advertisement | advertise on newsday

The Yankees added two runs in the ninth, getting four straight hits by Hicks, Headley, Holliday and Starlin Castro.

Tanaka came in 5-2 with a 4.05 ERA in 10 career starts against Boston, but that included a 1-0, 1.83 ledger in three starts last season.

Though Tanaka rarely shows emotion, and didn’t again Thursday, that should never be interpreted as a lack of fire.

“I enjoy the competition,” Tanaka said. “A lot of people thought, how well he was pitching to this point, that Sale had the upper hand. But I kind of wanted to go in and try to sort of beat the odds, I guess.”