The Padres, owners of the worst record in the majors, ended a six-game losing streak.
With starter Wade Miley still in the game, Alexi Amarista reached on a one-out bunt single in the eighth and Guzman broke a 1-1 tie with his homer to left-center.
The next six San Diego batters all reached base with the final two runs of the inning scoring on a fielding error by right fielder Justin Upton.
Andrew Cashner (3-3) worked the top of the eighth to get the win, allowing a walk and striking out one.
Miley (6-2) wound up going 7 1/3 innings, giving up four runs on six hits.