Updated

Jeff Karstens pitched into the eighth inning and the Pittsburgh Pirates took a 4-0 win over the Milwaukee Brewers at PNC Park.

Karstens (5-3) gave up seven hits and struck out four, but left in the eighth inning with a groin injury after giving up a pair of singles to start the frame.

"He had some great location and command with his pitches tonight," said Pittsburgh manager Clint Hurdle about Karstens. "He was able to keep most of them in check before leaving and I don't have any update on the injury."

Jose Tabata, Travis Snider, Michael McKenry and Karstens each drove in a run for the playoff-contending Pirates, who snapped a four-game losing streak.

Shaun Marcum (5-4) pitched for the first time in over two months and gave up four unearned runs on five hits with a walk and five strikeouts over five innings for the Brewers, who had a four-game winning streak stopped. Aramis Ramirez had three of Milwaukee's nine hits.

"I got a little tired there in the fifth inning, but other than that I felt pretty good," Marcum said.

The game stayed scoreless until the fifth when the Pirates put four runs on the board. Neil Walker reached base to start the inning when his hit to center was misplayed by Carlos Gomez. Two batters later, McKenry doubled Walker home and later scored on a Karstens single. A Tabata double followed by a Snider single each scored a run for a 4-0 game.

Meanwhile, Karstens faced the minimum through the first four innings, but gave up a leadoff double to Ramirez to start the top of the fifth. He stranded him there, though, as he struck out the next two batters and got Gomez to ground out and end the frame.

In the sixth, the Brewers got consecutive one-out singles from pinch-hitter Travis Ishikawa and Norichika Aoki, but Karstens struck out Rickie Weeks and induced a pop out from Ryan Braun to escape the jam.

Jeff Bianchi singled to leadoff the eighth for Milwaukee, the first hit of his career, and Nyjer Morgan followed with an infield single.

Karstens pitched a ball to Aoki before stepping off the field with the injury. Tony Watson took over and forced Aoki into a fielder's choice that saw Morgan forced out at second. Jason Grilli then took the mound and struck out Weeks before getting Braun to hit into a fielder's choice at short to end the frame.

The Brewers loaded the bases with two outs in the ninth against Joel Hanrahan, but he struck out Morgan to end the game.

Game Notes

Each team has won four games in the season series ... Marcum had been out since June 14 due to right elbow tightness. He fell to 2-2 in six matchups against the Pirates ... Karstens won his first game against the Brewers and is now 1-5 against them ... Milwaukee left nine men on base and batted 1-for-10 with runners in scoring position.