After an intentional walk to Hanley Ramirez, Chapman (2-1) walked Andrew Benintendi on five pitches to bring home Pedroia.

Robby Scott (1-1) got the win for the Red Sox, who got their first victory over the Yankees at home this season. It was Boston’s first game-ending walk since Sept. 23, 2000 against Baltimore.

Gary Sanchez had a two-run home run and an RBI single for the Yankees.

New York, which entered the four-game series 3 1/2 games behind AL East-leading Boston, had won four of the five previous meetings against its rival this season.

Drew Pomeranz was on the mound for Boston’s lone victory this season against the Yankees last month in New York. Pomeranz had seven strikeouts Friday, but allowed some pitches to get up in the zone. New York took advantage, scoring three runs in the fifth.

Ramirez put Boston up early, crushing his 14th home run over the left-center field fence in the third.

The Red Sox had a chance to get the lead back with runners on the corners in the seventh, but Benintendi’s long fly ball to center was reeled in on the warning track by Jacoby Ellsbury.

The Yankees struck first, getting on the board in their half of the third inning. Sanchez hit a hard liner that deflected off Bogaerts’ glove at shortstop and fell into left field, scoring Chase Headley. New York pulled within 3-2 in fifth on an RBI single by Brett Gardner to set up Sanchez’s go-ahead homer.

PLUGGING HOLES

Injuries ravished the Yankees prior to the All-Star break and they continued to work to make lineup adjustments on Friday.

With first baseman Greg Bird still out with an injured ankle, Garrett Cooper made his major league debut a day after coming over in a trade with Milwaukee. The Yankees also said that starting pitcher Michael Pineda could be facing Tommy John surgery on his pitching elbow.

New York did get a little good news as Matt Holliday (illness) returned to the lineup.

TRAINER’S ROOM

Yankees: Pineda was placed on the 10-day disabled list for the ulnar collateral ligament injury, and general manager Brian Cashman said it was the recommendation of the team for him to have Tommy John surgery. Pineda will get a second opinion before making a decision. … Bird could require surgery for his right ankle, which hasn’t responded to a cortisone shot.

Red Sox: Manager John Farrell said Brock Holt (vertigo) “is close” to returning from the 60-day disabled list. He was slated to DH with Triple-A Pawtucket on Friday and could make a position start there on Saturday.

UP NEXT

Yankees: RHP Luis Severino (5-4, 3.54 ERA) is winless in his last five starts. Severino was selected the American League All-Star team but did not play in the game Tuesday.

Red Sox: LHP Chris Sale (11-4, 2.75) makes his first start since taking the loss July 6 against Tampa Bay. Sale leads the AL in strikeouts with 178 and is 6-1 in eight starts at Fenway Park this season.

(Copyright (c) 2018 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed.)