The Pittsburgh Pirates won 5-2, completing a three-game sweep by holding off a Giants rally in the bottom of the ninth.