SAN FRANCISCO (AP) -- Buster Posey and Andres Torres homered, and Matt Cain extended San Francisco's scoreless streak against the Mets to 24 innings before New York finally scored in an 8-4 loss to the Giants on Saturday night.
The drives by Posey and Torres against Hisanori Takahashi (7-4) helped stake the Giants to a 6-0 lead after three innings.
It came as little surprise that the lead proved safe considering the Mets had scored only five runs in their previous five games, including back-to-back shutout losses to the Giants.
New York finally scored for the first time since the All-Star break when Ike Davis hit a two-run homer off Cain (7-8) in the seventh inning to cut San Francisco's lead to 6-2. That snapped the longest scoreless streak for the Mets since they went 30 innings without a run July 24-28, 1992.
Davis added a solo shot in the ninth for his second career multihomer game -- both against San Francisco.
Giants management challenged the pitching staff before the All-Star break to step it up and the starters have responded so far. Tim Lincecum got it started with a shutout Thursday night and Barry Zito followed with eight scoreless innings Friday.
Cain, who had lost his previous four decisions, picked up where they left off. He allowed two runs and four hits in seven innings to win for the first time since June 13. He had a 7.45 ERA during his five-start winless stretch.
Pablo Sandoval drove in three runs for the Giants, who have won a season-high five straight. San Francisco is 10-2 following a season-worst, seven-game losing streak.
Brian Wilson struck out Angel Pagan with two on in the ninth for his 25th save in 27 chances.
The performance of Posey has been a big reason for San Francisco's turnaround. The rookie is hitting .481 in July, helping the Giants become the highest scoring team in the majors this month.
Posey got the Giants started in the five-run second inning with a leadoff double. Juan Uribe and Sandoval hit RBI singles to make it 2-0 after one trip through the order.
Opponents' average against Takahashi goes up .138 points after the first time through the order, and the pattern continued against the Giants.
Torres hit a three-run homer in his second at-bat to make it 5-0 in the second. The leadoff hitter's eighth homer gave San Francisco as many runs that inning as the Mets had scored in their previous five games.
If that hole wasn't big enough, Posey added an opposite-field drive in the third inning to make it 6-0 and Takahashi's night was over soon after.
Takahashi, who was moved up in the rotation because of Mike Pelfrey's stiff neck, allowed six runs and seven hits in 2 2-3 innings.
NOTES: Posey has an 11-game hitting streak. He has joined Orlando Cepeda (1958) and Chili Davis (1982) as the only San Francisco rookies to have two double-digit hitting streaks. ... Mets SS Jose Reyes (sore right side) took batting practice, played catch and ran before the game but is not expected to return to the lineup until Monday in Arizona. ... Mets CF Carlos Beltran will get a day off Sunday after playing his first three days back from offseason knee surgery. ... San Francisco 2B Freddy Sanchez returned after missing Friday's game with an illness. ... Giants RHP Todd Wellemeyer will make a rehab start at Triple-A Fresno on Monday.