MIAMI (AP) The Miami Marlins faced a four-run deficit and stranded 16 runners, but they kept plugging away and eventually pulled ahead.
Dee Gordon tripled to lead off the 10th inning and scored on a walk-off base hit by Justin Bour to lift the Marlins to a come-from-behind 5-4 win over the Boston Red Sox on Tuesday night.
''When Dee hit that triple to start off the inning it's just one of those things where you have to get the run in,'' Bour said. ''All of the credit goes to him for that.''
The Red Sox led 4-0 in the sixth inning before the Marlins climbed back into the game with two runs in the sixth, one in the seventh and one in the ninth before Bour's heroics in the 10th.
''The first pitch was a ball so the next pitch I was looking for something over the plate and I was able to drive it,'' Bour said.
Gordon lined a triple to left-center field off Craig Breslow (0-2) as center fielder Mookie Betts' dive was unsuccessful.
''I didn't know (if he would catch it),'' Gordon said. ''I was running hard out of the box so whatever happens, happens.''
Breslow intentionally walked Martin Prado and struck out Derek Dietrich before Bour lined a base hit to left-center, ending the game
Red Sox manager John Farrell left shortly before the game after undergoing hernia surgery on Monday. Bench coach Torey Lovullo assumed managerial duties in his place.
''It will be a day-by-day thing with him,'' Lovullo said. ''If he can do it, I can guarantee he'll be out here. When you get to a certain spot, you have to sit back and listen to a professional. I think John wisely went home and got some rest.''
Bryan Morris (4-3) earned the victory with a scoreless 10th.
Five Miami relievers combined to retire the final 13 Boston hitters.
''To be able to come in and slam the door and retire 13 straight is huge,'' Marlins manager Dan Jennings said.
Conversely, the Boston bullpen was unable to hold a 4-0 lead.
''They didn't come in and get the job done,'' Lovullo said. ''These are guys that we believe in. They've done it all year long. They're going to continue to get the ball in their hands and find a way to get the job done.''
Miami was 4 for 16 with runners in scoring position.
''We left 16, that's quite a few men,'' Jennings said.
Adeiny Hechavarria sent the game to extra innings with a sacrifice fly in the bottom of the ninth inning off Junichi Tazawa, who was in search of his first save since 2012.
The Marlins trailed 4-3 in the ninth as J.T. Realmuto and Ichiro Suzuki each singled off Tazawa, whose wild pitch in the dirt advanced the runners to second and third. Realmuto scored on Hechavarria's deep fly ball.
''It's the same thing, you have to get outs,'' Tazawa said of closing. ''There's a little more tension. The job is the same, get outs.''
Boston knuckleballer Steven Wright allowed two runs and five hits in five-plus innings. He struck out four and walked five.
Wright exited in the sixth with a 4-0 lead after allowing the first two batters to reach base.
Ryan Cook relieved Wright and pinch-hitter Casey McGehee drove in a run with a groundout, then Gordon's RBI single cut the Marlins' deficit to 4-2.
Miami loaded the bases in the seventh with no outs, but only managed to score one run when Suzuki hit a sacrifice fly to pull the Marlins within 4-3.
Marlins left-hander Justin Nicolino allowed nine hits and four runs in 5 2-3 innings in his third career start.
''Guys like David Ortiz and (Pablo) Sandoval and growing up watching them was really cool, but actually getting to facing them and seeing them in the batter's box was pretty cool, too,'' Nicolino said.
Betts had an RBI single in the third to score Jackie Bradley Jr., who reached on a triple. Betts also had an RBI double in the fifth, which also plated Bradley for a 2-0 lead.
The Red Sox scored two runs in the sixth inning on a wild pitch by Nicolino and an RBI triple by Rusney Castillo, which ended Nicolino's outing.
Red Sox: LF Hanley Ramirez (toe) missed his third consecutive game, but manager John Farrell is hopeful Ramirez will return on Wednesday.
Marlins: RHP Jose Fernandez (right biceps strain) was placed on the 15-day disabled list retroactive to Aug. 8. ... OF Christian Yelich (right knee contusion) was scratched from the lineup, snapping a streak of starting 39 consecutive games.
Red Sox: LHP Eduardo Rodriguez (6-4, 4.17 ERA) takes the mound in the second game of a two-game series against the Marlins. Rodriguez has a 1-1 record and 2.84 ERA in his last three starts.
Marlins: LHP Adam Conley (1-0, 4.05) will make his second start of the season after allowing two runs in five innings in a 14-3 win against Cincinnati on July 11.