NEW YORK (AP) — Alex Cora watched the New York Yankees erase a late deficit for the second straight night, and the Boston Red Sox manager wasn't surprised.
"For them, it's fun to watch," he said. "For me, it's like, oh God, here we go again."
This time, the Red Sox rebounded after wasting a four-run lead for a win that seemed more important than most.
J.D. Martinez hit a tiebreaking home run against Dellin Betances leading off the eighth inning, just beyond Aaron Judge's reach at the right-field wall, and the Red Sox escaped New York with a 5-4 victory Thursday night that handed the Yankees only their second loss in 19 games.
"Definitely huge," Martinez said. "Kind of hoping that we can almost slow them down in a sense."
Boston moved back into a tie with the Yankees for the AL East lead at 26-11, the best record in the major leagues. The rivals have split six games this year and meet 13 more times but not until June 29 in the Bronx.
"You walk off there disappointed but also proud of the way the guys continue to compete through the end and give ourselves a chance on a night when maybe it doesn't look that way," Yankees manager Aaron Boone said.
Even Iris Cora admires the Baby Bombers.
"I hate to say it, but my mom kind of like — liked what happened with them," the Boston manager said. "It's a fun team. It's an athletic team, and I think the fans are buying into it."
Boston built a 4-0 lead against CC Sabathia as Hanley Ramirez drove in three runs with a run-scoring groundout in the first , an RBI single in a two-run third and a homer in the fifth just before a 55-minute rain delay .
But the Yankees tied the score in the seventh after loading the bases with one out against Heath Hembree.
Joe Kelly (2-0), who served a six-game suspension for hitting the Yankees' Tyler Austin with a pitch last month, was booed loudly when he entered. Kelly forced in a run with a four-pitch walk to Brett Gardner, gave up an RBI single to Judge and a run-scoring groundout to Didi Gregorius , who is hitless in 24 at-bats. Kelly then bounced a run-scoring wild pitch off catcher Christian Vazquez.
Martinez had driven in a run in the third with a liner off the glove of second baseman Gleyber Torres that was turned into a forceout, and as he walked to the plate in the eighth, Ramirez told him to hit a home run.
"He was saying it as a joke," Martinez remembered.
No joke. Martinez sent a 97 mph fastball from Betances (1-2) to the opposite field, just over Judge's outstretched glove.
"I was like blowing, praying, doing everything I can to push it over," Martinez said.
Judge reached over the fence, and a spectator's glove touched his. But the ball was clearly over the wall and Martinez circled the bases with his ninth home run.
"Once it goes past that imaginary line, it's fair game for him. So it's no interference," Judge said. "I just missed it."
Austin flied out on the first pitch he saw from Kelly with a runner on in the eighth. Kelly threw a called third strike past Neil Walker to end the inning with two on — the seventh Yankees batter caught looking as New York repeatedly questioned the strike zone of plate umpire Stu Scheurwater.
A night after giving up Gardner's go-ahead, two-run triple in a four-run eighth, Craig Kimbrel struck out Gardner, then retired Judge on a flyout and Gregorius on a chopper that Kimbrel snagged on the left side of the infield for his 301st career save and 10th in 12 chances this season.
"I enjoyed having the same part of the lineup up and getting another chance," Kimbrel said. "Mentally, yesterday's not going to get to me. I've blown many a save and come back the next day. It's part of my job."
Mookie Betts had three hits, raising his batting average to a major league-leading .361. New York, held without an extra-base hit for the first time this year, had won eight straight games overall and 11 in a row at home.
In the glow of the win, Ramirez didn't see the division race getting decided in the late stages.
"It's not going to be like this all year," he said. "We're going to take off."
Boston lefty Eduardo Rodriguez struck out eight — including six looking. He has a 2.25 ERA in six starts at new Yankee Stadium. Sabathia allowed nine hits in four innings as his ERA rose from 1.39 to 2.23.
Booed in his final weeks as a Yankees player two years ago, Alex Rodriguez was cheered when shown on the video board while watching the game after the rain delay.
Red Sox: RHP Tyler Thornburg, coming back from surgery last June 16 to correct thoracic outlet syndrome, made his fifth minor league rehab appearance. He gave up two runs and two hits while getting two outs for Double-A Portland. He will join the Red Sox in Toronto on Friday for a bullpen session. ... OF Jackie Bradley Jr. (.173) was not in the starting lineup for the second straight day and might not play Friday.
Yankees: 1B Greg Bird (right ankle surgery on March 27) played five innings in his first rehab game for Class A Tampa and was 0 for 3 with two flyouts and an RBI grounder. ... OF Billy McKinney (left shoulder sprain on March 31) played seven innings in left field during his first rehab appearance for the Tarpons and went 0 for 1 with a groundout and two walks.
Red Sox: Sale (3-1, 2.02 ERA) starts Friday at Toronto, which sends RHP Aaron Sanchez (2-3, 4.14) to the mound.
Yankees: RHP Sonny Gray (2-2, 6.00) starts Friday's series opener against Oakland, his first game against his former team since the Athletics traded him to New York last summer.
More AP baseball: https://apnews.com/tag/MLBbaseball