Andrew Benintendi's hit bounced a handful of times before finding its way into center field for the winning run and a big four-game sweep over the rival Yankees.
The Red Sox now find themselves in firm control of the AL East.
Benintendi's RBI single with two outs in the 10th capped Boston's rally from three runs down in the ninth against New York closer Aroldis Chapman, and the Red Sox completed a four-game sweep with a 5-4 victory Sunday night.
"Any 10 hopper that goes through for a hit feels pretty good," the usually quiet Benintendi said, breaking into a grin. "Everybody knew how big the series was. We came in and did what we wanted to do. We kind of stole this one."
Boston opened a 9 1/2-game lead atop the division over the Yankees, who lost their season-high fifth straight.
"It feels like another great win, obviously it was against our rivals," Boston's J.D. Martinez said.
Mookie Betts hit his 26th homer for Boston (79-34), which has won eight of nine games and owns the majors' best record.
In-depth news coverage of the Greater Boston Area.
The Yankees hadn't been swept in a four-game series by the Red Sox when they entered a series 30 or more games over .500 since Hall of Famer Ted Williams' rookie season in 1939, according to the Elias Sports Bureau.
"A tough way to obviously end a tough weekend, but we can't let this define what's been a great season," manager Aaron Boone said.
Sandy Leon looped a two-out single off Jonathan Holder (1-3) in the 10th and advanced on a wild pitch. Tony Renda pinch-ran before Benintendi's single up the middle to the right of the second-base bag into center field.
Matt Barnes (4-3) worked a perfect inning in the top of the 10th.
For the Yankees, it was a stunning reversal of the Boston Massacre in 1978 when the Yankees came to town and swept the Red Sox en route to erasing a large lead and capturing the AL East.
"We lost these four games here, but what I can tell you is that we're gonna keep battling. We're gonna keep playing ball," Chapman said through a translator. "There's no looking back."
It snapped his streak of converting 22 straight opportunities since his last blown save on May 4.
With New York leading 4-1 in the ninth, Chapman loaded the bases on walks before Martinez's two-out, two-run single pulled Boston within one. Third baseman Miguel Andujar then bounced a throw to first on Xander Bogaerts' grounder, with pinch-runner Jackie Bradley Jr. racing home with the tying run.
Red Sox starter David Price took a shutout into the seventh, giving up two runs and four hits with five strikeouts and three walks.
Playing on a beautiful mid-summer night with a sellout crowd amped from the opening pitch, Price and Masahiro Tanaka were locked in a scoreless duel before Betts hit a hanging cutter completely out of Fenway Park over the Green Monster in the fifth.
Price, tagged for 12 runs over 4 1/3 innings in his other two starts against the Yankees this season, left to a rousing ovation with two on and nobody out in the seventh.
Heath Hembree walked Shane Robinson before Bogaerts booted what looked like a sure double-play grounder, allowing two runs. Stanton followed with an RBI single and Gleyber Torres had a sacrifice fly.
Tanaka gave up one run and six hits, striking out nine and walking one in 4 2/3 innings.
Working the ESPN Sunday Night Baseball telecast for his first time in Fenway, color analyst and former Yankee Alex Rodriguez discussed his fight with former Red Sox catcher Jason Varitek in 2004 during the broadcast, saying the current Yankees need a spark.
"The fans here, they took that as a pivotal moment on winning a championship," he said. "And I'm not saying the Yankees need to start a fight by any means, but I'd love to see more fight, more action, more Paul O'Neill attitude and sometimes you want a guy in the room to stand up and not necessarily throw a chair, but get in somebody's face and show some emotion, some passion."
Boston rallied from a 0-3 series deficit in the 2004 ALCS en route to winning its first World Series since 1918.
Yankees: OF Aaron Judge (fractured right wrist) played catch, but still hasn't swung a bat. Boone said: "They hope it's a pain-free situation. There is a chip in there, a broken wrist, you've got to get it right." ... Boone also said he hopes C Gary Sanchez (strained right groin) will be running at full speed by the end of the week and LHP J.A. Happ (hand, foot and mouth disease) could start Thursday.
Red Sox: LHP Eduardo Rodriguez (sprained right ankle) threw a bullpen that Cora called "impressive." ... 3B Rafael Devers (strained left hamstring) is slated to play for Single-A Lowell in a rehab assignment Monday.
Yankees: RHP Lance Lynn (7-8, 4.89 ERA) is in line to make his first start for the Yankees on Monday against the White Sox. He was acquired from Minnesota on July 30.
Red Sox: LHP Drew Pomeranz (1-5, 6.56) is slated to start the opener of a nine-game road trip Tuesday in Toronto.
Freelance writer Gethin Coolbaugh contributed to this story.