After Giles's two-out single, Davis gave up a second hit and two walks but went 7 2/3 innings to improve to 4-5. He struck out eight.
Brandon Lyon pitched a 1-2-3 ninth for his 22nd save.
Arizona, which has won four of its last five, got its runs in the sixth inning from Alex Romero, who drove in two, and Mark Reynolds, who drove in one and also scored once.
Padres pitcher Chris Young, in his first start since getting smashed in the face May 21 by an Albert Pujols line drive that broke his nose, surrendered five hits and two walks while striking out eight over five innings. The loss went to Clay Hensley (1-2), who gave up three runs -- two earned -- in two-thirds of an inning.