SAN FRANCISCO -- Jhonny Peralta hit a two-run homer among his two hits and Carlos Martinez earned his second win as a starter, and the St. Louis Cardinals beat the reeling San Francisco Giants 7-2 on Thursday.
Martinez (2-3) also drove in a run for the Cardinals, who won their second straight after losing three in a row. Martinez allowed a run and five hits in five innings. He walked one and struck out six.
Madison Bumgarner (9-6) fell to 0-3 over his past four home starts after allowing five runs -- four earned -- and six hits over five innings. He walked three and struck out six.
Bumgarner also drove in a run for the Giants, who have lost 17 of 22 and fell out of first place in the NL West.
Matt Carpenter continued ripping Giants pitching, extending his hitting streak against them to 11 games with a 2-for-4 effort. He has a .519 (28 for 54) career average against the Giants and has hit safely in 18 of his 20 games, including the postseason, against them.
Yadier Molina added three hits and Oscar Tavares, John Jay and Shane Robinson each drove in a run for the Cardinals.
Peralta's first-inning home run put St. Louis ahead to stay. Bumgarner drove in a run for the Giants in the third, but then gave up three runs in the fourth -- two on a single from Martinez.
Robinson, pinch hitting for Martinez in the sixth, tripled home a run. Tavares added an RBI in the seventh.
The Giants loaded the bases with two outs in the fifth, but Martinez got Buster Posey on a swinging strike three to end the threat.
In the sixth, Tyler Colvin walked, Adam Duvall singled and Brandon Crawford punched a single into right field. An error allowed Colvin to score.
Sam Freeman, Seth Maness and Jason Motte combined to keep the Giants at bay.