Tony Clark hit two homers and knocked in three runs; Scott Drew had two hits and one RBI; while Eric Byrnes, Chad Tracy and Hernandez all had one RBI for the Diamondbacks, who have won their last two games.
Hernandez (2-1) walked three batters and struck out two.
Jose Valverde earned his eighth save of the season.
Adrian Gonzalez hit a three-run homer, and Jose Cruz Jr. had two runs and three of the six hits for the Padres, who couldn't hold on to their 3-0 first inning lead and lost for the third time in their last four games.
The losing pitcher was Chris Young (2-2). He was charged with six runs -- five earned -- and six hits in 5 1/3 innings.