SAN FRANCISCO - Sidelined by a wrist injury, Hunter Pence hadn't played for the Giants in a month. But he wasted little time re-establishing his presence as the Giants beat the Mets, 3-0.

Pence turned in an impressive one-man show, knocking in a pair of runs. He also turned a stunning double play, sliding to make a catch on a Ruben Tejada looper before making a perfect throw to cut down Curtis Granderson as he tried to score from third base.

Veteran righthander Bartolo Colon allowed three runs (two earned) on 10 hits over six innings. But the Mets offense stalled yet again.

For the 10th time this season, for the third time in their last eight games, the Mets found themselves on the receiving end of a shutout.

At the center of the Mets' loss was the Giants' two-run third inning, a rally spurred on by an error.

It belonged to third baseman Daniel Murphy, who fielded Matt Duffy's grounder but flubbed the exchange, thus extending the frame.

Gregor Blanco had already led off with a drag bunt before Joe Panik lined a single. Murphy's error loaded the bases for Pence, who grounded into force out but knocked in the Giants' first run.

Brandon Crawford's sacrifice fly made it 2-0. And the way the Mets offense languished against Giants starter Matt Cain, even a two-run lead seemed insurmountable.

The Mets (43-42), who had come off consecutive shutout victories, can still return to New York Wednesday with a winning record on a daunting six-game West Coast road trip.

But they'll have to provide more support for Jacob deGrom than they did for Colon (9-7).

Cain, a three-time all-star, had not pitched in his home park in nearly a year. His season was shut down last August when he underwent surgery to remove bone chips in his right elbow.

Before he could make his return this season, he was sidelined yet again, this time with a strained flexor tendon in his right arm.

He endured a bumpy return to action last week, allowing five runs on seven hits including a pair of homers in a loss to the Marlins. His velocity dragged.

But against the Mets, Cain enjoyed a return to form. He did not allow a hit until there was one out in the third, when Kevin Plawecki ripped a double off the fence in left-center.

Two batters later, Cain issued consecutive two-out walks to Granderson and Tejada, loading the bases for Murphy.

But he got Murphy to swing over the top of a pitch low in the zone, ending what would be the Mets' best threat against him.

The Mets had the makings of a rally in the sixth inning, this time when Granderson bashed a stand-up triple to start the frame.

But Pence made sure that Cain would depart with nothing but zeros to his name.

When Tejada lifted a fly ball into shallow leftfield, Pence entered a slide, made the catch, then popped up to make a perfect throw to home plate.

It arrived on a line, in time to nab Granderson, who mistakenly thought he could get the Mets on the board by tagging up.