Gregorius drove in Chris Owings, who had doubled with one out off Luke Gregerson (6-8).
Paul Goldschmidt connected for his 36th home run in the sixth inning for the Diamondbacks. Martin Prado had two of Arizona's seven hits in the game.
Josh Collmenter (5-4) picked up the win in relief of Wade Miley, who went six scoreless innings, allowing four hits and striking out seven. Brad Ziegler notched his 12th save.
The Padres toed the game 1-1 in the eighth on a passed ball that allowed Reymond Fuentes to score from third.