The victory kept the Padres from sweeping the four-game series.
Walker hit his 11th home run of the season in the Pirates' five-run fourth inning and drove in a run in a three-run seventh. Jose Tabata matched Walker's three RBI, hitting a two-run double in the fourth and helping the rally in the seventh.
Gerrit Cole (9-7) gave up four hits and one run while walking three and striking out 12 in six innings of work to get the win. San Diego starter Ian Kennedy (6-10) was roughed up for six runs and eight hits in 3 2/3 innings in taking the loss.
San Diego led when Tommy Medica singled in a run in the first. That lead was short-lived as Tabata was hit by a pitch leading off the bottom of the first and Walker got him to third with a single. Tabata scored on an Andrew McCutcheon fielder's choice.
Pedro Alvarez hit a home run with one out in the fourth and Tabata added a two-run double just before Walker's home run for the 6-1 Pittsburgh lead.
Tabata's two-run single and Walker's RBI base hit came back-to-back in the seventh and Alvarez got the final home run on a groundout in the eighth.