Evan Longoria, in his sixth straight start in the three-hole, had three hits and two RBIs, and his tiebreaking homer just to the left of the batter's eye in center field in the eighth inning gave the Giants a 3-2 victory over the D-backs on Sunday.