Terms of the deal weren't announced, but The Arizona Republic reported Goldschmidt will get $32 million and the deal includes a club option of $14.5 million for 2019.
The 25-year-old had a breakout season in 2012, when he emerged as the club's everyday first baseman. He compiled a .286 average with 20 home runs, 43 doubles and 82 RBI over 145 games.
He followed that up with a torrid Cactus League spring training season, hitting .410 in 28 games.
"This is the only place I wanted to be so I'm thrilled to know that I will be here long-term," Goldschmidt said in a statement. "I can't wait for the season to start, and I hope that we can bring another World Championship to the fans of Arizona."