MIAMI — Dee Gordon tripled to lead off the 10th inning and scored on a walk-off base hit by Justin Bour to lift the Miami Marlins to a come-from-behind 5-4 win over the Boston Red Sox on Tuesday night.

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.

Gordon lined a triple to left-center field off Craig Breslow (0-2) as center fielder Mookie Betts’ dive was unsuccessful. Breslow intentionally walked Martin Prado and struck out Derek Dietrich before Bour lined a base hit to left-center, ending the game.

Bryan Morris (4-3) earned the victory with a scoreless 10th inning.

Five Marlins relievers combined to retire the final 13 Boston hitters.

Miami left 16 men on base and was 4 for 16 with runners in scoring position.

Adeiny Hechavarria sent the game to extra innings with a sacrifice fly in the bottom of the ninth inning off Junichi Tazawa.

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.

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 and Gordon’s RBI single cut the Marlins’ deficit to 4-2.

Miami loaded the bases in the seventh with no outs, but managed to score only one run, when Suzuki hit a sacrifice fly to pull the Marlins within 4-3.

Marlins starter Justin Nicolino allowed nine hits and four runs in 5 2-3 innings.

Betts had an RBI single in the third to score Bradley, 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.