Jim Rassol-USA TODAY Sports

Michael Conforto slugged a tie-breaking, two-run homer in the 11th inning, leading the San Francisco Giants to a 5-2 win over the host Miami Marlins on Wednesday afternoon.

San Francisco snapped a five-game losing streak.

Mike Yastrzemski added another two-run homer later in the 11th inning, also off reliever Devin Smeltzer (0-1), as the Giants avoided what would've been a three-game sweep.

Prior to Conforto's homer, Miami's bullpen had held the Giants scoreless for 15 innings in this series.

Entering Wednesday and since April 11, the Marlins had ranked first in the majors in bullpen ERA (0.72).

Miami has still won six of its past eight games.

Marlins starter Trevor Rogers left after three-plus innings due to left forearm tightness. He allowed one run, three hits, one walk and struck out three.

Like Rogers, Giants starter Alex Cobb also got a no-decision, pitching five innings and allowing one run, seven hits and one walk. He struck out a season-high eight batters.

Giants reliever Camilo Doval (1-2) earned the win as he escaped a bases-loaded, one-out jam in the 10th. Taylor Rogers got the last two outs -- stranding the bases loaded -- for his first save with the Giants.

San Francisco opened the scoring in the fourth. Wilmer Flores blooped a single and scored from first when Darin Ruf doubled off the wall in left.

Trevor Rogers left the game after that pitch. The Giants went on to load the bases with two outs against reliever George Soriano. However, Miami escaped the jam when Heliot Ramos hit a groundout.

Miami tied the score in the fifth as Garrett Hampson got an infield hit, stole second and scored on Garrett Cooper's two-out single to left.

Just like the Giants in their fourth-inning rally, Miami went on to load the bases. But Bryan De La Cruz's 104-mph, one-hop smash was backhanded by third baseman J.D. Davis, who threw to first to end the threat.

In the bottom of the 10th inning, Miami loaded the bases with one out. Doval then struck out De La Cruz with a 101-mph fastball up, and he struck out Avisail Garcia with a low slider.

Miami cut its deficit to 5-2 on Jon Berti's RBI double in the bottom of the 11th.

But Taylor Rogers, a lefty, got Miami's two toughest lefty hitters -- Jazz Chisholm Jr. and Luis Arraez -- to end the game.

More must-reads:

TODAY'S BEST
Yankees ace takes big step in first rehab stint
Kirk Cousins updates Achilles rehab
Mets rapidly approaching rock bottom with another ugly loss
Rangers rule out depth forward for Game 3 against Panthers
Another heartbreak for Justin Allgaier as Chase Elliott wins Xfinity Series race
NBA Finals path clears for Celtics with devastating Pacers injury update
PGA Tour golfer Grayson Murray dies at 30
Yankees' Hal Steinbrenner under fire over Juan Soto comments
Former NFL first-round pick retires after 'terrifying' health scare
Penguins want to add legendary former player to front office
Rays place outfielder on 10-day injured list
Former NFL QB brutally rips Denver Broncos head coach Sean Payton
Mets' Kodai Senga diagnosed with triceps inflammation, shut down
Watch: Luka Doncic hits game-winning three-pointer as Mavs take 2-0 lead over Wolves
Rangers outlast Panthers in Game 2 to even series
Yankees star Juan Soto has eyebrow-raising comments on upcoming free agency
Bears defender shares advice he gave QB Caleb Williams after 'frustrating' day
NCAA settlement might make college athletics more competitive
Jets QB Aaron Rodgers insists focus has been football, not politics
Heartbreak for Heim, Honeycutt as Sanchez wins Truck Series race at Charlotte

Want more sports news?

Join the hundreds of thousands of fans who start their day with Yardbarker's Morning Bark, the best newsletter in sports.