The 33-year-old Lopez had been eligible for salary arbitration. He had asked for $2,875,000 and the Giants had offered $2 million.
Lopez can earn an additional $50,000 each for pitching 55 or 60 innings in the deal he received Thursday. He went 2-0 with a 1.42 ERA in 27 outings for the Giants, who acquired him at the trading deadline from Pittsburgh.
Lopez made nine appearances in the postseason, two during the Giants' five-game World Series victory over the Texas Rangers. The franchise won its first title since 1954.