BOSTON (AP) — Michael Wacha allowed two hits in seven innings in his return from a shoulder injury, and Rafael Devers homered on Sunday night to lead the last-place Boston Red Sox past the division-leading New York Yankees 3-0.

Tommy Pham had three hits for the Red Sox, who took two of three from New York — their first win in a real series against an AL East opponent this season in 13 tries.

New York has lost nine of its last 11 games but still has a double-digit lead in the division; the Red Sox are seventh in the race for the AL’s three wild-card spots. The rivals with a history of lengthy games played this one in just 2 hours, 15 minutes.

Activated from the injured list earlier in the day after missing five weeks with right shoulder inflammation, Wacha (7-1) took a perfect game into the fifth inning. He walked one and struck out nine — including major league home run leader Aaron Judge twice.

Ryan Brasier pitched a perfect eighth and Garrett Whitlock pitched a 1-2-3 ninth for his fourth save, striking out Judge to end a nine-pitch at-bat and then getting Josh Donaldson on a slow roller to short to end it.

Jameson Taillon (11-3) allowed three runs on six hits, striking out four to pick up his first loss since July 5.

Judge was 0 for 4 with three strikeouts, snapping a string of 14 straight games of reaching base. He had walked at least twice in each of the previous four games.

Boston’s only official AL East “series” win was a one-game victory over the Orioles on Thursday. In multigame series against the division, the Red Sox are 1-11-1.

TRAINER’S ROOM

Yankees: OF/DH Giancarlo Stanton (Achilles tendon) will take batting practice on Monday at Yankee Stadium. If all goes well, he will begin a minor league rehab assignment.

Red Sox: Kiké Hernández (hip) and Rob Refsnyder (knee) are expected to be activated for the start of the series in Pittsburgh on Tuesday.

UP NEXT

Yankees: Gerrit Cole (9-4) will start against Tampa Bay.

Red Sox: After an off day on Monday, the Red Sox open a three-game series against the Pirates. Nick Pivetta is expected to start the opener.