The two sides reached a verbal agreement on the deal on Tuesday and the Giants said Lincecum signed the contract Friday after taking his physical.
The two-time NL Cy Young Award winner gets a $500,000 signing bonus and salaries of $18 million this year and $22 million in 2013.
Lincecum had asked for a near-record $21.5 million in salary arbitration and had been offered $17 million by the Giants. He remains eligible for free agency following the 2013 season.
Lincecum was plagued by poor run support last season and went 13-14 with a 2.74 ERA last year for his first losing record.