San Francisco acquired the 32-year-old from the Miami Marlins in December to replace Pablo Sandoval, who left as a free agent and signed with Boston. McGehee hit .287 with 29 doubles, four homers and 76 RBIs in his lone season with the Marlins after playing for the Rakuten Eagles of Japan's Pacific League in 2013.
McGehee made $1.5 million last year and had asked for a raise to $5.4 million when the sides exchanged proposed arbitration salaries last month. The World Series champion Giants had offered $4 million.
He was San Francisco's last player in arbitration. The agreement Thursday also includes award bonuses.