Posey, Brett Pill, Pablo Sandoval (two RBI) and Gregor Blanco each drove in a run during the big first inning and the Giants went on to record their first victory in a four-game series following a pair of losses to Pittsburgh.
Tim Lincecum (7-13) corralled the victory after allowing three runs on three hits over 5 1/3 innings, overcoming four walks while striking out eight.
Six San Francisco relievers combined for 3 2/3 innings of scoreless relief, capped by Sergio Romo's 31st save.
Francisco Liriano (14-6) was tagged with the loss, yielding four runs on nine hits over four innings as the Pirates fell into a first-place tie with St. Louis atop the National League Central.
Tony Sanchez went 2-for-4 with a solo homer and two RBI for the Bucs.
Video of Victoria’s Secret models trying to 'twerk' hits Instagram
Megyn Kelly: Santa Claus and Jesus are both white men