Two-time Cy Young winner Tim Lincecum was nearly unhittable as he led the San Francisco Giants to a 3-0 win over the Florida Marlins at Sun Life Stadium on Saturday.

Lincecum allowed just two hits in seven innings while striking out 10 as he edged Javier Vazquez in an intriguing pitching duel and helped San Francisco keep the heat on the National League West-leading Arizona Diamondbacks who defeated the New York Mets 6-4.

"When you're struggling the way we are, that's what you need," Giants manager Bruce Bochy said of Lincecum's performance. "You need somebody on the mound who can go out there and help take care of business. Hopefully we get the team on the winning track."

Jeff Keppinger blasted a home run in the first inning, while Nate Schierholtz and former Marlin Cody Ross also scored capitalizing on sloppy play by the Marlins.

Schierholtz led off the fifth inning with a double and advanced to third base on a throwing error by Marlins outfielder Logan Morrison. Schierholtz then scored on a wild pitch by Vazquez.

Another wayward pitch by Vazquez in the sixth inning allowed Ross to advance to second base after hitting a lead-off single and he later scored on a two-out double by Aubrey Huff.

"Javy (Vazquez) pitched his heart out," Marlins manager Jack McKeon said. "They got a few breaks, we made a few mistakes and basically that's the ballgame."

Brian Wilson closed the game with a scoreless ninth inning for his 35th save.