Giancarlo Stanton led off the 11th inning with an RBI single Friday night and the New York Yankees came back to edge the Baltimore Orioles 4-3.

Stanton also homered as the Yankees remained 1 1/2 games ahead of Boston in the the race for the first AL wild card.

Stanton, who was limited to designated hitter duties during the pandemic-shortened 2020 season and in his first 81 appearances this year, has played the outfield in 15 of his last 31 games, a span in which he is hitting .324 with 10 homers and 27 RBIs.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

The Yankees are an AL-best 24-8 since Stanton’s outfield debut July 30.

"It’s been awesome helping us win (and) putting up some good numbers at the same time," Stanton said. "But most important is the wins. If I’m not playing good and we’re not playing good, there’s no real benefit to that in terms of the long-term goal."

Ryan Mountcastle hit an RBI single in the 10th that put Baltimore ahead 3-2. DJ LeMahieu answered with a tying single in the bottom half.

Yankees reliever Clay Holmes (6-2) wriggled out of a first-and-third, none-out jam in the top of the 11th.

"It’s tough to win on the road in extra innings and we didn’t score in the top of the 11th, which opened the door for them," Orioles manager Brandon Hyde said.

Stanton, whose homer in the fourth provided the Yankees’ first hit against Orioles starter John Means, grounded a 2-1 pitch from Dillon Tate (0-6) up the middle, easily scoring automatic runner Aaron Judge from second with the winning run.

It was the eighth career walk-off hit for Stanton, who was mobbed by teammates on the infield grass.

"He is in a great spot, having good at-bats — obviously the home run tonight and then smokes the game-winner," Yankees manager Aaron Boone said, "He’s locked in and focused and carrying out his plan really well right now."

The comeback win was the 36th of the season for the Yankees and improved them to a baseball-best 49-27 in games decided by two runs or fewer.

"We’d like to pull away a little bit every now and then," Boone said. "But it is nice that in these close situations, our guys seem to play their best."

LeMahieu lofted a sacrifice fly in the fifth to give the Yankees a 2-0 lead.

Trey Mancini’s two-out homer in the sixth chased Yankees starter Nestor Cortes Jr. Jorge Mateo, a former Yankees farmhand, tied the game by homering off Jonathan Loaisiga with one out in the seventh.

Cortes gave up four hits and two walks while striking out seven. He has a 3.81 with 46 strikeouts over 49 2/3 innings in his last 10 appearances, nine of them starts.

Means allowed three hits and walked two with five strikeouts over five innings. Six Orioles pitchers limited the Yankees to six hits.

"I was really encouraged by the guys out of the pen," Hyde said. "I thought we pitched really well against a really good team."

DRYING OUT

The Somerset Patriots, who are in their first season as the Yankees’ Double-A affiliate, posted on their official Twitter site Friday a picture of a dry-looking TD Ballpark one day after the stadium was submerged in water following the torrential rains delivered Wednesday by the remnants of Hurricane Ida.

The historic storm, which delivered up to 11 inches of rain in the central New Jersey area, destroyed the cars and inside belongings of Patriots players and coaches, who had their automobiles parked at TD Ballpark while Somerset was on a road trip.

The road trip was scheduled to conclude Sunday, but the Patriots announced a three-game homestand against the Hartford Yard Goats slated to begin Tuesday will instead be played in Connecticut.

"I saw a picture of the earlier of the field looking really good today, which is encouraging," Boone said. "Hopefully this is something that doesn’t have a devastating impact on what’s been a great situation in Somerset."

Yankee Stadium, which absorbed several inches of rain Wednesday, looked no worse for the wear Friday.

TRAINER’S ROOM

Orioles: RHP Hunter Harvey (shoulder/lat) is healthy but will remain at Triple-A Norfolk after posting a 14.43 ERA in his first four rehab appearances. Harvey last pitched for Baltimore on June 28.

Yankees: SS Gleyber Torres (left thumb) was activated from the 10-day injured list prior to the game and went 0 for 4. Boone said Torres, who missed 22 games, would likely sit out Saturday afternoon’s game before resuming regular playing time Sunday. … INF Gio Urshela (left hand) sat out a second straight game. Boone said an MRI showed no damage and that Urshela was able to swing, play catch and participate in some defensive drills Friday afternoon.

UP NEXT

Orioles: RHP Chris Ellis (1-0, 3.09 ERA) is slated to make his third start since being claimed off waivers from the Tampa Bay Rays.

Yankees: LHP Jordan Montgomery (5-5, 3.52 ERA) is 1-0 with a 2.30 ERA in three starts since coming off the COVID-19 injured list.