Tim Lincecum struck out seven in seven innings and the San Francisco Giants took advantage of a two-run error by shortstop Ruben Tejada to beat the New York Mets 4-1 on Tuesday night and snap a season-long five-game losing streak.

Tejada's throw to first on the back-end of a potential double-play ball by Brandon Crawford in the second inning sailed into New York's dugout fence. The error handed Matt Harvey (1-1) a hard-luck loss and lifted San Francisco's spirits even more on a day the franchise acquired two-time All-Star right fielder Hunter Pence from Philadelphia.

Justin Turner's RBI double in the second was all the Mets managed off Lincecum (5-11). The two-time NL Cy Young Award winner allowed six hits and one walk in another step toward turning around the worst season of his career.

Jeremy Affeldt pitched two scoreless innings for his second save in three chances this season.

(Copyright 2012 by The Associated Press.  All Rights Reserved.)