MIAMI (AP) It was a much-needed win for the San Francisco Giants, but it came at a great cost.
Pablo Sandoval's tie-breaking two-run single in the 16th inning lifted the Giants past the Miami Marlins 6-3 on Thursday, but the Giants also lost third baseman Evan Longoria to a broken left hand after he was hit by a pitch.
''A great win, but a tough loss,'' Giants manager Bruce Bochy said.
Longoria sustained a fracture to his fifth metacarpal, which could require surgery. A decision is expected in the next couple of days.
''Obviously the goal is to decide something as soon as possible and then get going in the right direction, whether that's put a cast on it and just let it sit or have some sort of surgery and go that route,'' Longoria said.
Longoria initially stayed in the game to run after he was hit in the fourth inning, but came out in between innings.
''It wasn't my legs,'' Longoria said. ''I just hate coming out of the game right away. I've always thought it looked bad. I knew right away that it didn't feel right, but I just figured I could run and in the meanwhile let (Alen Hanson) get loose and come into the game.''
Longoria is hitting .246 with 10 home runs and 34 RBIs in 67 games.
''It's a tough loss,'' Sandoval said. ''I don't know how many days he's going to be out, but we're going to miss the guy. He's a great hitter, great defensive player, and a great teammate. I hope he recovers well and comes back to help us get to the postseason.''
Andrew McCutchen hit a two-run homer to continue his torrid month and Mac Williamson also homered for the Giants, who salvaged the final game of a four-game series and beat the Marlins for only the second time in the last 10 meetings.
''It was a great win to head home on after a tough series,'' Bochy said. ''I'm looking forward to getting out of Miami, trust me.''
Giants' starter Dereck Rodriguez pitched 6 2-3 innings, allowing two runs with his father and former Marlins' World Series championship catcher Pudge Rodriguez sitting behind home plate. Ty Blach (4-5) also pitched 6 2-3 innings for the Giants without allowing a run. He gave up seven hits, walked two, and struck out three.
''Two quality starts in one game. I'll take it,'' Rodriguez said.
Sam Dyson came on for Blach to get the final out with two runners on for his first save of the season.
McCutchen started the 16th with a single, Brandon Crawford walked and Alen Hanson singled to load the bases of Elieser Hernandez (0-4). Sandoval's single to center made it 5-3, and Gorkys Hernandez added a sacrifice fly later in the inning. The runs were the first for the Giants since the second.
''I just tried to calm down - everyone was tired - and tried not to do too much,'' Sandoval said.
Miami had two runners on in the bottom of the 16th for Bryan Holaday, who flew out to end the game.
''Epic game,'' Bochy said.
It was the longest game of the season for the Giants and the second-longest for the Marlins, who went 17 innings in a 2-1 win over the Chicago Cubs on March 30.
Both teams had opportunities in extra innings after the Marlins tied the game in the bottom of the ninth off Hunter Strickland on a sacrifice fly by Lewis Brinson. Second baseman Joe Panik was unable to hold onto a pop up near the foul line, allowing the lead-off runner to reach.
It was the eighth time in the series the Marlins came back to tie the game.
''It was one of those series where you kind of play back and forth,'' Marlins manager Don Mattingly said. ''Close games. Good for a lot of situations.''
The Giants looked to take the lead in the 11th on a double by Hanson, but Crawford was thrown out at the plate.
Miami threatened in the 13th when Bochy ordered an intentional walk to Starlin Castro load the bases with two outs and Hernandez due to bat because the Marlins were out of position players. Hernandez bounced out to Blach.
''With Castro up there, that was an easy one,'' Bochy said. ''I wasn't going to let him beat us there. We were in a pretty good situation there.''
The Marlins had another opportunity in the 15th with runners on the corners and one out, but Justin Bour grounded into a double play. Bour slammed his helmet to the ground in disgust.
''I saw it off the bat and I thought we might have a chance,'' Blach said.
McCutchen hit a two-run homer in the first inning for the second straight game. Five of his eight home runs have been this month. He went 3 for 7 to raise his batting average to .339 (19 for 56) in June, historically the best month of his career. He has 11 multi-hit performances in his last 18 games.
Williamson's fourth home run of the season gave the Giants a 3-0 lead against Dan Straily in the second inning.
JT Riddle's solo shot, his third, cut the deficit to 3-1 in the fifth.
Holaday's two-out base hit to left pulled Miami within 3-2 in the seventh, ending Rodriguez's outing.
''It's really good to see everyone in this room just continues to keep working toward every single at-bat, getting a hit, getting a hit, just no one giving into anything, everyone scratching and clawing through every single pitch,'' Straily said.
Rodriguez scattered seven hits and struck out four in his third start.
SMITH EXPECTED TO GO ON BEREAVEMENT LIST
Miami's Caleb Smith was not with the club due to a funeral and is expected to go on the bereavement list. Mattingly said Smith will make his next scheduled start at San Francisco on June 18.
HOLADAY'S STREAK CONTINUES
Holaday threw out Mac Williamson trying to steal second base in the fourth inning. It was the ninth consecutive base stealer Holaday has thrown out, extending his franchise record. The nine straight is the most in the majors since Arizona's Miguel Montero threw out nine in a row in 2011.
Marlins: RHP Brett Graves (left oblique) is nearing a return and the plan is for him to begin out of the bullpen.
Giants: LHP Derek Holland (4-6, 4.54 ERA) will take the mound Friday to begin a three-game series at the Los Angeles Dodgers. The Giants are 6-4 against their rivals this season.
Marlins: RHP Jose Urena (1-8, 4.59) begins a three-game series at Baltimore on Friday.
More AP baseball: https://apnews.com/tag/MLBbaseball
Copyright 2018 by AP. Any commercial use or distribution without the express written consent of AP is strictly prohibited.