The NL West-leading Padres lost for the third time in four games and had a six-game winning streak against the Diamondbacks snapped.
Hudson (3-1) gave up three hits, one of them a homer by Will Venable in the third, and struck out four over 7 2/3 innings.
Jordan Norberto came on with one on and two out in the eighth and retired the only man he faced. Aaron Heilman worked a perfect ninth for his fifth save.
Adam LaRoche hit his 18th homer of the year to give the Diamondbacks the lead in the second and Justin Upton singled in a run in the third after Jon Garland had issued a pair of two-out walks.
Garland (10-8) allowed only three hits, but walked six over seven innings, taking the loss.