Clint Barmes smacked a grand slam to key a nine-run fourth inning and the Pittsburgh Pirates avoided a three-game sweep with an 11-5 win over the San Diego Padres on Sunday.

Neil Walker went 5-for-5 with a homer, two RBI and scored twice, and Andrew McCutchen had two hits and drove in a pair for the Pirates, who snapped a three-game skid. Michael McKenry also knocked in two in the victory.

"That's the thing about this group, even when we were down 5-0, we knew the importance of focusing and staying focused in this game and grinding out the at-bats," said Walker. "Got the bases loaded there and Barmes came up with maybe one of the biggest hits of the year."

Erik Bedard (7-12) earned the win despite giving up five runs -- three earned -- on five hits with six strikeouts over five frames.

Chris Denorfia homered and Logan Forsythe had two hits and scored twice for the Padres, who lost at PNC Park for the first time since Sept. 18, 2009. San Diego had won its last 11 games in Pittsburgh entering Sunday.

Ross Ohlendorf (4-3) was saddled with the loss after giving up seven runs -- six earned -- on five hits and three walks over three-plus frames.

San Diego plated four in the first to take an early lead.

Denorfia smacked a leadoff homer to get things started.

Forsythe walked and Carlos Quentin was hit by a pitch to put two on with one out. Jesus Guzman followed with a single to score Forsythe. Cameron Maybin ripped a grounder to short but Barmes' throw sailed over the head of first baseman Gaby Sanchez, allowing Quentin and Guzman to score.

The Padres pushed another run across in the second. Forsythe doubled then scored on Chase Headley's ground out.

Headley cued one off the end of his bat up the first baseline. The ball was rolling in foul territory but slowly drifted across the line and was fielded by McKenry, but no one covered the plate and Forsythe scored from second to put the visitors ahead 5-0.

Walker's RBI single got the Bucs on the board in the third, but they broke it open in the fourth after plating nine.

Ohlendorf walked in a run with the bases loaded before giving up a grand slam to Barmes. Barmes turned on a hanging-slider, hammering it off the foul pole in left for his first-career grand slam.

Bedard drew a walk and Walker singled to put two on for McCutchen, who crushed a two-run double to center. Garret Jones followed with a triple to score McCutchen and McKenry singled to bring home Jones.

"The whole inning was bad," said Ohlendorf about the fourth. "The grand slam was certainly really bad. The whole inning I just wasn't sharp."

Walker's homer in the seventh put the Pirates up 11-5.

Game Notes

The Pirates reinstated pitcher Juan Cruz from the 15-day disabled list and optioned pitcher Jared Hughes to Triple-A Indianapolis...Pittsburgh is 58-0 when leading after eight innings...The Padres' 11-game winning streak at PNC Park was the longest active winning streak for any team over an opponent at their home ballpark. The Padres are 28-10 all-time at PNC Park and have never lost consecutive games or a series there.