MIAMI — 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 days.

Longoria is hitting .246 with 10 home runs and 34 RBI in 67 games.

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.

PHILLIES 9, ROCKIES 3: Vince Velasquez took a no-hitter into the seventh inning, Rhys Hoskins and Nick Williams hit solo homers and Philadelphia won at home.

Trevor Story lined Velasquez’s 105th pitch to left for an RBI double with two outs in the seventh, ending Velasquez’s bid for the fourth no-hitter in the majors this season. Velasquez (5-7) retired 20 of the first 21 batters before issuing a walk to Carlos Gonzalez, followed by Story’s double. He got a standing ovation as he walked off the mound after the hit.

AMERICAN LEAGUE

TIGERS 3, TWINS 1: JaCoby Jones’ two-run homer capped a three-run seventh inning as Detroit rallied past visiting Minnesota.

Jones was hitting .135 in his last 10 games and had struck out in his first two at-bats before hitting Lance Lynn’s 3-1 fastball for his fifth home run.

Michael Fulmer (3-5) improved to 5-0 in five career starts against the Twins. He pitched seven innings, allowing one run on five hits and a walk with four strikeouts in ending a three-start winless streak.

ASTROS 7, ATHLETICS 3: Justin Verlander pitched five-hit ball over seven innings and visiting Houston beat Oakland for its eighth straight win.

The winning streak is the Astros’ longest since they won 11 straight from May 25 to June 5 last season.

Khris Davis and Matt Olson homered for the A’s. Both came off Verlander (9-2), who struck out seven, allowed three runs and didn’t walk a batter while earning his fifth consecutive win.

INDIANS 5, WHITE SOX 2: Francisco Lindor and Jose Ramirez homered, Mike Clevinger struck out 11 in seven innings and Cleveland won at Chicago.

Lindor led off the game against Carlos Rodon with his 15th home run. He also singled and scored in the seventh when Ramirez broke a 2-2 tie with a two-run drive to right-center against Chris Volstad (1-4) for his 20th homer.

Clevinger (5-2) gave up two runs and five hits.

NOTES

INDIANS: Cleveland activated outfielder Brandon Guyer from the 10-day disabled list and designated outfielder Melky Cabrera for assignment.

OWNERS MEETING: Commissioner Rob Manfred said at the owners meeting in New York that he’s pleased with improvements in the pace of play.

Games this year were averaging 2 hours, 59 minutes, 49 seconds through Wednesday; last year, they averaged 3:05:11.

Mound visits by catchers, coaches, managers and other teammates for nonpitching changes are down, too, from 7.41 per game last year to 3.92 this season.