NEW YORK — Brett Gardner capped a slump-busting performance with a go-ahead, two-run triple off Craig Kimbrel in the eighth inning, Aaron Judge followed with a homer and the New York Yankees rallied to beat the Boston Red Sox 9-6 Wednesday night for their 17th victory in 18 games.

Kimbrel (1-2) entered with two on and one out to face Gardner seeking the first five-out save of his career. Gardner drilled a full-count pitch into left-center, well over the head of center fielder Mookie Betts, who was playing shallow. Neil Walker scored easily from third and rookie Gleyber Torres raced from first and slid past a lunging tag attempted by catcher Christian Vazquez.

Judge followed with a line drive to center measured at 117 mph off the bat, his ninth homer of the season. He had three hits and three RBIs as New York won its eighth straight overall and 11th in a row at home.

The win moved the Yankees into first place in the AL East.

Aroldis Chapman pitched the ninth for his ninth save. J.D. Martinez got a hit off Chapman and ran into the closer trying to round first base. Martinez argued for interference, but the umpires held him at first on a grounder hit inside the bag. Chapman struck out Mitch Moreland to end it.

Gardner doubled and scored twice earlier in the game after Manager Aaron Boone predicted he would soon break out. The Yankees’ speedy leadoff man had batted .147 without an extra-base hit over his previous 19 games, but Boone was confident Gardner would contribute soon based on his exit velocities and other internal metrics.

New York (26-10) broke a tie with Boston for first place in the AL East and has sole possession of the best record in the majors for the first time since July 27, 2012. The Yankees are on a 35-8 tear in the Bronx since Sept. 2, including the postseason, and at 16-5 have the best home record in the majors this year.

The Yankees had walk-off wins in three of their previous five home games. This rally came an inning earlier.

Hanley Ramirez put Boston ahead 6-5 with a two-run homer in the seventh. Ramirez turned on a hanging slider from reliever Chad Green and crushed it to the back of the second deck in left field for his fourth homer. He admired the shot from home plate, then thumped his chest after rounding third base during a leisurely home run trot.

Giancarlo Stanton drove in two with a go-ahead double off Rick Porcello in the third inning a day after hitting a pair of solo homers in a 3-2 Yankees victory. It’s the first time Stanton has RBI in consecutive games this season, and he improved to 10 for 19 with seven RBI against Boston during his first season in pinstripes.

Mitch Moreland and Andrew Benintendi homered as Boston chased Masahiro Tanaka after 51/3 innings. Tanaka allowed four runs.

Yankees reliever Jonathan Holder (1-1) cleaned up a mess left by Chasen Shreve in the eighth, getting Benintendi to ground out with the bases loaded.

Porcello allowed five runs in 51/3 innings – his first time giving up three or more runs this season.

LHP David Price was diagnosed with carpal tunnel syndrome after twice experiencing numbness in his pitching hand this season. Manager Alex Cora called it “good news compared to anything else.” Price will throw at Yankee Stadium on Thursday before being re-evaluated. … 2B Dustin Pedroia (knee) will play five innings in a game at extended spring training Thursday. Cora is still unsure when Pedroia might be ready to return. … RHP Steven Wright (domestic violence suspension) pitched six innings of one-run ball for Triple-A Pawtucket on Tuesday. His next appearance will be out of the bullpen.

Only subscribers are eligible to post comments. Please subscribe or to participate in the conversation. Here’s why.

Use the form below to reset your password. When you've submitted your account email, we will send an email with a reset code.