SAN FRANCISCO -- For the Giants to achieve their ultimate goal of winning their third World Series in five years, they'll need Buster Posey's dramatics and Matt Cain's dominance.
They received both on Friday night at AT&T Park, which largely accounted for their 4-2 triumph over the Mets.
Posey's two-run homer off reliever Carlos Torres broke a 2-2 tie in the eighth inning. The drive also ended a stretch of 93 at-bats without a home run for Posey, who hit 24 in 2012 and 18 in 2010, when the Giants captured the Series.
Friday's homer, Posey's eighth of the season, extended his hitting streak to five games and concluded his second three-hit effort in less than a week. Both facts suggest that Posey, who has been bothered by stiffness in his lower back, is beginning to find his form at the plate.
"He's been hitting the ball hard. He just hasn't gotten it up in the air," manager Bruce Bochy said. "Tonight he did."
Cain hadn't pitched since May 21, when he strained his right hamstring and hit the disabled list for the second time this season, but he displayed none of the dullness that such a layoff might have induced. He lasted seven innings, allowing two runs and three hits after maintaining a perfect game for four innings and a no-hitter through five.
This was the type of performance that became routine for Cain in 2010, when he yielded one unearned run in three postseason starts, and 2012, when he won San Francisco's clinching games in the first two postseason rounds.
"[Posey and Cain are] leaders on our team," said closer Sergio Romo, who pitched a perfect ninth inning for his 19th save. "And today they showed why."
Posey and Cain received help as the Giants became the first team in the Major Leagues to win 40 games, a level they didn't reach last season until July 6 -- and their record was a dismal 40-46. They're currently 40-21, having won three in a row and 11 of their last 14.
Brandon Hicks and Brandon Crawford combined to generate the Giants' first pair of runs, both off Mets starter Jon Niese.
"We had quite a quinella with those two," Bochy said.
Hicks tripled and scored on Crawford's sacrifice fly to open the scoring in the fifth inning. After Daniel Murphy's two-run homer off Cain put New York ahead in the seventh, Hicks and Crawford enabled the Giants to pull even in their half of the inning with the team's specialty, the two-out run. Hicks walked to prolong the seventh, advanced on a wild pitch and scored on Crawford's single up the middle.
"That was my mistake. I shouldn't have let Crawford get anything to hit," Niese said. "Both those runs, I made mistakes, and he put together some good at-bats. With him being the only lefty in the lineup, I shouldn't make those mistakes."
That set the stage for the Giants' eighth, which Torres opened by issuing a four-pitch walk to Angel Pagan. Pagan reached second base on Hunter Pence's groundout. Up came Posey, who redirected a 1-0 fastball into the stands in left-center.
Posey, who loathes basking in his feats, described his homer in typically spare fashion.
"Fortunately, I got a good pitch I could handle, and it went out," Posey said.
Of Posey's eight homers this season, four were hit at AT&T Park, four on the road. But any similarity between the two locations ends there, as he has batting averages of .191 at home and .326 on the road.
Asked about the disparity, he said, "Baseball's weird."
Nothing was weird about Cain's effort. It was pure hardball, defying the potential effect of missing two starts.
"He threw that first pitch 93 [mph], and it's like, 'OK, he's here,' " Romo said. "All of a sudden, we're in the sixth inning with no hits."
Cain, who attributed his effectiveness to fastball command, savored the ability to join the fun after a second stint on the disabled list.
"It felt great," Cain said. 'It stinks when you're sitting there and you're watching the guys playing well. You want to be a part of it. You want to be able to help out."
Curtis Granderson drew a leadoff walk in the fifth, ending Cain's chances of duplicating the perfect game he threw against Houston on June 13, 2012. His no-hit prospects vanished with Ruben Tejada's infield single led off the sixth inning. Tejada hit a grounder to deep shortstop that Crawford fielded before making a wide, two-hop throw to first base.
"The thing with Craw is, he has so much range," Cain said. "It would have been a ground ball into left field with most other shortstops."
But Cain wasn't at all upset as the zeros disappeared from the scoreboard.
"It was a nice game to be a part of," he said.