The announcement Saturday came a day after multiple reports said the two sides were close to a deal.
Goldschmidt says he loves it in Arizona and doesn't want to play anywhere else.
The contract runs through the 2018 season with a $14.5 million club option for 2019.
The 25-year-old first baseman hit .286 with 43 doubles, 20 home runs and 82 RBIs last year, his first full season in the majors.
The agreement means three infielders are locked into long-term contracts with the Diamondbacks. Earlier this year, Arizona reached contract agreements with second baseman Aaron Hill and third baseman Martin Prado.