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.