SAN FRANCISCO (Reuters) - San Francisco Giants ace Tim Lincecum struck out 12 batters in a dominant outing to give the defending World Series champions a 2-1 victory over the Minnesota Twins Thursday.

Lincecum allowed three hits and walked two batters in seven innings of work en route to his first win since May 27.

"I always wondered if I throw a pitch, what's going to happen if I leave it over the middle -- I wasn't thinking anything like that," said Lincecum.

"I always talk about having conviction in your pitches and believing in them in that given moment. I think that's kind of what led up to today's success."

San Francisco opened the scoring in a second inning in which Pablo Sandoval hit a lead-off single and Pat Burrell followed with a double. Sandoval then scored on a ground ball off the bat of Miguel Tejada.

Cody Ross drove in what would prove to be the winning run when he singled to center field, scoring Aubrey Huff, who had led off the eighth with a double.

Giants reliever Brian Wilson recorded his 21st save in 23 chances despite allowing the first two Minnesota batters to reach base in the ninth.

Twins starter Brian Duensing pitched well in defeat allowing one run on three hits in over six innings while striking out five and walking two.

"I felt pretty good," Duensing said. "I felt like I was locating pretty decent ... I thought the defense made some big plays, too, which is good. But it's just tough to score runs against Lincecum."

(Reporting by Mike Mouat in Windsor, Ontario; Editing by Ian Ransom)