The deal breaks down to $3.2 million this year, $5.7 million in 2013 and $8.25 million in 2014.
The Giants also reached one-year agreements with outfielders Melky Cabrera ($6 million) and Nate Schierholtz ($1.3 million), and reliever Santiago Casilla ($2.2 million), leaving only pitchers Sergio Romo and Tim Lincecum on the arbitration ledger.
Lincecum filed for a $21.5 million salary, while the Giants offered $17 million. Both offers represent a record for a player with less than six years' experience, bettering the $18.5 million Derek Jeter won, and the $14.25 million the Yankees offered in 2001.
Sandoval, 25, hit .315 with 23 home runs and 70 RBIs last season. He is .307 in four seasons with the Giants, with 114 doubles, 64 home runs and 247 RBIs.