BOSTON — Masahiro Tanaka made Yankees history at Fenway Park on Thursday night.

And not the good kind.

Tanaka was pummeled for a dozen runs — all earned — in a 19-3 loss to the Red Sox in a horrid outing to open a four-game series.

Tanaka is the first Yankees starter to allow 12 earned runs since Carl Mays did it on July 17, 1923, when Mays gave up 13 in eight innings in Cleveland.

Tanaka didn’t make it out of the fourth in his second straight brutal outing versus Boston.

The previous one came in London on June 29, when Tanaka gave up six runs and didn’t even make it out of the first inning. And those are the only times Tanaka has faced Boston this year.

“It’s something we’ve got to dive into,’’ manager Aaron Boone said. “They’ve been on a lot of pitches and seen him well. It’s something we’ll examine and see if we can prevent or eliminate that.”

Boone and Boston manager Alex Cora noted Tanaka made a lot of mistakes over the middle of the plate.

Tanaka said through an interpreter he didn’t know why the Red Sox had hit him so hard.

“I felt like my stuff wasn’t bad and the pitches weren’t bad, but it ended up the way it ended up,’’ the right-hander said. “I do need to look at some stuff. … There’s a lot of disappointment.’’

He likely wouldn’t have survived the first Thursday, either, if the Yankees’ bullpen didn’t enter the game on fumes, with Stephen Tarpley arriving from Triple-A Scranton/Wilkes-Barre to eat some innings.

Tanaka allowed seven runs in the first, and it was 3-0 just three batters into the game, as he started by giving up a leadoff single to Mookie Betts, a walk to Rafael Devers and then a three-run blast to Xander Bogaerts.

With two outs and the bases loaded, Tanaka got ahead of Jackie Bradley Jr. 0-2, but Bradley hit a two-run double to extend the inning and Betts followed with the same to give the Red Sox a 7-0 lead.

Tanaka recovered for an easy second and pitched out of a jam in the third, but he allowed six of seven batters to reach in the fourth before Boone finally got him out of the game.

Christian Vazquez’s RBI double off Tarpley drove in Moreland to finish the scoring on Tanaka, whose ERA jumped from 4.00 to 4.79 after his 3¹/₃-inning nightmare.

It was the latest concerning sign from Tanaka, who has struggled with his splitter for much of the season — including in the sixth inning of his previous outing against the Rockies in The Bronx.

Since a solid outing against the Astros on June 26, Tanaka has been bad. There was the nightmare in London, a rocky outing at Tampa Bay, a good start versus the Blue Jays and then the sixth-inning problems against the Rockies.

Combined with Thursday’s nightmare, Tanaka has quickly gone from All-Star to question mark.