MIAMI — In one of their most active trade deadlines in years, the Yankees added seven new faces to their roster, all of them in uniform Friday night for the start of a three-game series against the Marlins.

Four of them — relievers Jake Bird, David Bednar and Camilo Doval and utility man Jose Caballero — single-handedly helped sink the Yankees in their first post-trade deadline game Friday night.

Doval, brought on to hold a two-run lead, allowed three runs, with Agustin Ramirez, a former Yankee farmhand, bringing in Xavier Edwards with a walk-off infield fielder’s choice on a trickler some three feet in front of the plate as the Marlins handed the Yankees a brutal 13-12 loss in front of 32,299 at Marlins Park.

With two runners on and one out in the ninth, Edwards singled to right where Caballero overran the ball. That allowed a second run to score, tying it at 12, and allowed Edwards to take third.

It was a wild set of late innings.

A suddenly hot Anthony Volpe homered for the third time in his last four games, which drew the Yankees even at 10 in the eighth after Bednar allowed a tying homer go-ahead RBI single to cap a six-run bottom of the seventh.

Caballero pinch ran for Ben Rice, who hit a pinch-hit single with two outs in the ninth, and stole second. McMahon, brought over from the Rockies late last week to fill the club’s hole at third base, banged a single back up the middle to give the Yankees an 11-10 lead. Volpe went 4-for-5, the last of those hits was an RBI double that scored McMahon to make it 12-10.

The Yankees built a 9-4 lead entering the bottom of the seventh largely on the backs of their roster holdovers.

Trent Grisham’s three-run shot, his 19th homer of the season, made it 9-4 in the top of the frame.

Giancarlo Stanton, who spent the first eight years of his career with the Marlins, got the Yankees on board in the fourth with a three-run homer, his ninth since coming off the injured list on June 16, to make it 3-0. Cody Bellinger’s two-run single and Jasson Dominguez’s RBI single highlighted a three-run fifth that made it 6-0.

Dominguez went 3-for-4 with two runs and Grisham went 2-for-4 with three runs.

Bird came on for the bottom of the seventh and almost immediately got into trouble. After loading the bases with one out, he served up a grand slam to Kyle Stowers to bring the Marlins within 9-8. In came Bednar, who after retiring the first batter he faced, allowed the second home run of the game by Javier Sanoja, this one tying it at 9. The next two batters singled and Ramirez’s RBI single gave the Marlins a 10-9 lead.

Carlos Rodon started strong but did not finish that way, allowing four runs, two hits and five walks in 4 2/3 innings, striking out nine. The lefthander did not allow a hit until the fourth when the Marlins scored four times to pull within 6-4. Two of the runs were inherited when Jonathan Loaisiga couldn’t get out of a two-on, two-out jam.

Marlins righthander Janson Junk retired the first nine batters he faced but ended up allowing six runs, six hits and one walk in five innings.

Extra bases

It appears Aaron Judge’s stay on the injured list won’t be a long one.

Just as he, and the Yankees, indicated last Sunday when the outfielder was put on the IL with a right flexor strain.

Before Friday night’s game, manager Aaron Boone said Judge, who accompanied the team south, was scheduled to take batting practice Friday and Saturday before heading to Tampa on Sunday. There, at the club’s minor league complex, Judge will take at-bats against minor leaguers “to hopefully put him in position to be activated Tuesday or Wednesday,” Boone said.

The plan remains for Judge, when he does return, to see time primarily at DH to give his elbow additional time to rest.

Erik Boland

Erik Boland started in Newsday’s sports department in 2002. He covered high school and college sports, then shifted to the Jets beat. He has covered the Yankees since 2009.