Denard Span singled home the go-ahead run in the sixth and Buster Posey homered an inning later for the San Francisco Giants, who held on to beat the San Diego Padres 5-4 Friday night in a matchup between two of the worst teams in baseball.