Miami, FL (Sports Network) - Jeff Mathis doubled in the deciding run in the bottom of the eighth, as Miami got past San Francisco, 6-5, in the finale of a three-game set.
Mathis added a solo homer, while Ed Lucas, Adeiny Hechevarria and Donovan Solano each drove in a run for the Marlins, who avoided a sweep and won for the third time in their last five.
Chad Qualls (4-1) tossed 1 1/3 innings of scoreless relief and Steve Cishek followed suit in the ninth to earn his 27th save.
Hunter Pence slugged a two-run homer and Brandon Crawford added a solo blast for the Giants, whose three-game win streak ended.
Sandy Rosario (3-1) was charged with the winning run on three hits in his one inning on the mound.