SAN FRANCISCO (AP) Matt Cain was more impressed by Hunter Pence's defensive gem in the sixth inning than he was with his own winning return to AT&T Park.
Pence's sliding catch that he turned into a double play ended the New York Mets' best chance of scoring and helped preserve Cain's first win in nearly a year.
It also convinced Cain why the Giants desperately need Pence healthy and in the lineup.
''He brings that energy, that excitement,'' Cain said after San Francisco ended its seven-game losing streak with a 3-0 win over the Mets on Tuesday night. ''He was probably fired up as anybody after he made that play. The moment was just perfect.''
Pence, activated from the disabled list earlier in the day, provided the Giants with a big spark offensively and defensively. The veteran outfielder drove in San Francisco's first run with a fielder's choice grounder in the third and singled in Panik in the fifth to make it 3-0.
He also came up with the game's defining moment when he made a sliding catch in foul territory on Ruben Tejada's long fly ball in the sixth, then threw home to catch Curtis Granderson trying to tag up from third.
''He put it right on the money,'' San Francisco manager Bruce Bochy said. ''It's one of the best plays I've seen.''
Cain (1-1) had not pitched at the Giants' waterfront ballpark since July 9, 2014, when he earned his last win before missing the final half of the season following elbow surgery.
The three-time All-Star pitched two-hit ball over six innings with seven strikeouts. Cain retired the first seven hitters, struck out Daniel Murphy to get out of a bases loaded jam in the third, then allowed just one runner over his final three innings.
''It's been a long time, a long road,'' Cain said. ''I definitely didn't think it was going to be this long in between being back out here but it did. Today, it couldn't have been better.''
All-Star reserve Joe Panik had two hits and scored twice for the Giants.
New York's Bartolo Colon (9-7), winless since June 12, allowed three runs and 10 hits in six innings.
Kevin Plawecki had two of the Mets' four hits.
One night after getting shut out for the eighth time this season, the Giants jumped on Colon and took advantage of New York's sloppy defense. Colon misplayed a soft comebacker in the second inning, while Daniel Murphy bobbled a ground ball in the third that led to two San Francisco runs.
That ended the Mets' 21-inning scoreless streak, their longest of the season.
Both of Pence's RBIs came against Colon.
''He's a good player. If you check you'll see that he has good numbers against me. I think maybe that's why they put him in the lineup today.''
Four San Francisco relievers combined to retire the final nine batters. Santiago Casilla pitched the ninth for his 21st save.
Mets: RHP Jenrry Mejia was activated from the restricted list before the game after completing an 80-game suspension for testing positive for performance-enhancing drugs. Mejia was suspended in April after testing positive for the steroid Stanozolol. To clear room on the 40-man roster the Mets transferred Buddy Carlyle to the 60-day disabled list.
Giants: OF Nori Aoki (broken leg) could rejoin the team two weeks after the All-Star break, according to manager Bruce Bochy. ... LHP Jeremy Affeldt threw a bullpen session before the game. Affeldt will either throw to hitters next or go to the minors to make a rehab appearance. ... OF Ryan Lollis was optioned to Triple-A Sacramento.
Mets: RHP Jacob deGrom (8-6) pitches the series finale Wednesday afternoon in just his second career start against San Francisco. In his last 31 starts overall, deGrom has a 2.15 ERA.
Giants: RHP Jake Peavy (0-3) has won three of his previous five starts against the Mets but has a 3.82 ERA in those games.