Yankees starting pitcher Masahiro Tanaka stands on the mound as...

Yankees starting pitcher Masahiro Tanaka stands on the mound as the Red Sox's Mike Napoli rounds the bases after his solo home run in the ninth inning at Yankee Stadium on Saturday, June 28, 2014. Credit: Kathleen Malone-Van Dyke

It was the kind of night in which one mistake was going to get the starting pitcher a loss.

And at the end of a brilliant outing, Masahiro Tanaka threw that pitch -- after twice shaking off Brian McCann.

It was a 96-mph fastball on a 1-and-2 count with two outs in the top of the ninth inning, and Mike Napoli slammed it to rightfield. His line-drive homer just cleared the wall and gave the Red Sox a 2-1 win over the Yankees in front of a shocked crowd of 48,433 at the Stadium.

"He had been excellent all night," Joe Girardi said. "He made a mistake with a fastball, he didn't get it where he wanted it. He did have a lot of success with the split, so I'm not sure if he was . . . It's not where he's trying to throw it and he made a mistake with the location. You have to live with it and go from there."

McCann first called for a splitter and then called for a slider. Tanaka shook off both, later saying through his interpreter: "I wanted to go hard outside."

And Napoli, who struck out on a splitter in the sixth inning, hit the fastball hard for his 10th homer of the season. As he returned to the dugout, Fox microphones picked him up saying "what an idiot!" in reference to Tanaka's choice of a fastball.

Said Napoli: "I was pretty surprised. I had two strikes and I was trying to see something up. In my mind I was saying, 'Hang a splitter,' but I got something up in the zone I could handle."

McCann was quick to defend his pitcher, who lost his second straight decision.

"There is no wrong pitch with Tanaka," McCann said. "Every pitch he throws is the right pitch . . . It was 96 [mph] on the black [of the plate].''

Tanaka (11-3, 2.10 ERA), who allowed two runs, seven hits and one walk with eight strikeouts, was terrific, but so was Red Sox starter Jon Lester (9-7, 2.92).

The lefthander held the Yankees hitless through five innings and ended up allowing an unearned run and five hits in eight innings. Koji Uehara pitched a perfect ninth for his 17th save, striking out two.

The third-place Yankees (41-38) are two games behind the Blue Jays, who lost their second straight to the White Sox, in the AL East. The Red Sox (37-44) are seven games back.

Both Boston runs came on homers, with David Ross' fourth of the season giving the Red Sox a 1-0 lead in the third. The Yankees tied it without benefit of a hit in the bottom of the third against Lester, who walked two and struck out six. Derek Jeter's grounder drove in Brian Roberts, who had reached on an error to lead off the inning, to tie the score at 1-1.

"He just cuts it, he sinks it, he throws his curveball, he lives on the corners," Girardi said of Lester, who came in 12-6 with a 3.96 ERA in 28 career starts against the Yankees. "He did what he always does, he locates. He pitched extremely well tonight."

After Brett Gardner's leadoff single in the sixth, Ross threw him out trying to steal. Jeter and Jacoby Ellsbury followed with consecutive singles, but Mark Teixeira flied out and Carlos Beltran struck out to end the inning.

Neither team had a ton of chances with runners in scoring position. The Yankees went 0-for-5 and stranded six; the Red Sox were 0-for-4 and stranded four.

"It's a marquee pitching matchup," McCann said. "These games happen all the time and this game was won late. But to be disappointed? He pitched as well as you could possibly pitch. The ball [Napoli] hit out was 96 on the black. You move on and tip your hat. But, man, I can't say enough about how good Tanaka is."

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 6 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME