BOSTON -- The New York Yankees' bats arrived just in time to help extend their longest win streak of the season.
Gary Sanchez hit a tying home run with two outs in the ninth inning, DJ LeMahieu had a go-ahead double in the 12th and the Yankees rallied past the Boston Red Sox 6-5 Friday night for their ninth straight victory.
New York improved to 8-0 over its longtime rival this season. Dating to last year, the Yankees have won 11 in a row over the Red Sox, one short of its best streak ever against them.
"I had absolute confidence we were going to find out a way back in this game," LeMahieu said. "I feel like we're playing like we should be playing. . We're all clicking."
The victory moved the Yankees (30-21) percentage points ahead of Minnesota (31-22) for the No. 4 seed and home field in the first round of the playoffs. The fourth-seeded club will host the No. 5 team in every game of the best-of-three series.
The Yankees won on a night in which sluggers Aaron Judge and Giancarlo Stanton were both in the lineup together for the first time since Aug. 8 after recently returning from stints on the injured list.
Sanchez said their return come at a perfect time.
"They're key pieces to our team," he said through a translator. "When they are in the lineup they have certain energy and an intimidation factor."
The Yankees, coming off hitting a record 19 home runs in three days against Toronto, trailed 4-3 with two outs in the ninth.
Sanchez, who's shown recent signs of breaking out of a season-long slump, tied it with a line drive home run off Matt Barnes that just made it over the top of the Green Monster.
"He was sitting on a curveball, and he got it and he didn't miss it," Red Sox manager Ron Roenicke said.
Sanchez hit a two-run double in the seventh that cut Boston's lead to 4-2.
Luke Voit hit an RBI single in the 11th for the Yankees. Boston tied it in its half of the inning thanks to a wild pitch by Loaisiga and an RBI single by Christian Arroyo, who also had a three-run homer.
LeMahieu doubled with two outs in the 12th.
Boston's Martin Perez pitched six scoreless innings, allowing just three hits, a walk and striking out seven. But the Red Sox relievers allowed five hits and four runs over the next three innings.
This was Judge's second game back since re-aggravating a strained right calf on Aug. 26. Stanton was activated Tuesday after going on the injured list Aug. 9 with a left hamstring strain.
Both were quiet until the eighth inning when Judge got aboard with a one-out single. Stanton then lined a double into the left field corner, scoring Judge from first to cut Boston's lead to 4-3.
Judge and Stanton went a combined 2 of 9, striking out three times.
Yankees manager Aaron Boone said he was proud of how his team hung in throughout the various momentum swings of the game.
"It's starting to be playoff baseball," Boone said. "There were a lot of big pitches on both sides. A lot of big at-bats on both sides. ... The guys didn't mail it in at all. They kept grinding, battling and fought their way back in the game."
Yankees: Boone said the team will be careful with Judge and Stanton's workload as they gear up for the postseason. He said Stanton will likely have Saturday off after playing two straight games. Judge will probably rest in the series finale on Sunday.
Red Sox: RF Alex Verdugo left the game in the third inning with left hamstring tightness after injuring himself while running the bases.
Yankees: LHP J.A. Happ (1-2, 3.96 ERA) will make his eighth start of the season. He had a no-decision in his last start when he went five innings Sept. 13 against Baltimore, giving up five hits and a run.
Red Sox: RHPr Chris Mazza (1-1, 5.57) makes his fifth start of the season. He's given up 10 runs over 14 1/3 innings in his four previous starts.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
How Mookie Betts changed the super-sabermetric World Series into the super-fun Series
In baseball's bash-or-bust era, Betts showed what sets him -- and the Dodgers -- apart as L.A. bids for a title.
World Series 2020: Los Angeles Dodgers didn't need Clayton Kershaw's best in Game 1 -- but they got it
L.A.'s offense took the pressure off its ace in the World Series opener as Kershaw & Co. blew away the Rays.
Tampa Bay Rays' Kevin Cash goes against trend, leaves Tyler Glasnow in to throw career-high 112 pitches
Rays manager Kevin Cash said his thinking in sticking with starter Tyler Glasnow in the fifth inning of Tuesday's World Series Game 1 was "just trust that he had plenty of stuff to keep us right there."
Mookie Betts compares himself to other Mookies
Mookie Betts ranks himself among other Mookies, including former NBA player Mookie Blaylock.
Los Angeles Dodgers rookie right-hander Tony Gonsolin will start World Series Game 2
Rookie right-hander Tony Gonsolin will start for the Dodgers in World Series Game 2 against the Rays on Wednesday.
Betts just having fun playing baseball right now
Mookie Betts joins SportsCenter to discuss the Dodgers' Game 1 win including his race around the bases as well as his home run.