PITTSBURGH -- Los Angeles had lost the first three games of its series against Pittsburgh, and Dodgers manager Dave Roberts was having deja vu. It was not comfortable.
"It's one of those, yeah, not again (things)," Roberts said of watching Scott Kazmir give up four runs and contemplate having to pull his starter before the first inning ended.
"But there's still a lot of baseball left after that first inning. Scott was one hitter away from us trying to get eight innings out of our 'pen, but he beared down and made pitches when he needed to."
The Dodgers came back from that four-run hole for a 5-4 win Monday afternoon, avoiding being swept by the Pittsburgh Pirates. They have not been swept by Pittsburgh in a four-game series since 1944.
Kazmir (6-3), one of six Los Angeles pitchers, allowed four runs on four hits in five innings. Kenley Jansen pitched the final 1 1/3 innings for his 22nd save.
Los Angeles (42-36) won it with a four-run fifth inning. A.J. Ellis' infield single to deep short drove home Yasiel Puig to make it 5-4.
"I just knew I had to bust my tail down the first-base line," Ellis said. "Great team win. Man, guys were stepping up all over the place. Scott Kazmir, first and foremost."
The Pirates (37-40) took a 4-0 lead in the first on two walks, two singles and a double. The keys were Starling Marte's bases-loaded RBI single, Sean Rodriguez's bases-loaded walk and Erik Kratz's two-run single.
That inning took a 40-pitch toll on Kazmir.
"That was a rough first inning, to say the least," Kazmir said. "Honestly, I just didn't feel the same. I didn't feel like my energy was there. I don't know if it was the heat zapped me or what, but I just kind of felt underwater that first inning.
"It seemed like as soon as I got to the dugout and was able to cool off, I was kind of woken up and ready after that. Just a complete change in how I felt that first inning and on."
He retired the side in order in the next three innings on a combined 22 pitches, with three strikeouts.
Pittsburgh starter Francisco Liriano (4-8) allowed five runs, four of them earned, on four hits in 4 1/3 innings. He failed to get a win for his sixth straight game and, in that span, has walked 24 batters.
"My mechanics, I think," Liriano said of the problem. "I'm missing my spots. It'd be nice to put a pitch where I need to. I'm not getting as many swings as I used to get."
As Los Angeles took the field for the third, Kazmir summoned the grounds crew to work on the mound. The reshaping they did also seemed to help him.
"I just felt like the way it was shaped was a little tough for me to get down the slope," Kazmir said. "It was more like a hole right there by the rubber, which I could deal with, but after that it was like a big hump. I didn't feel like I was going down the slope. I felt like I was going uphill. So once they flattened that out I felt a lot more comfortable."
Kazmir left for a pinch hitter in the sixth, having thrown 97 pitches, and the Los Angeles bullpen went to work.
"Their bullpen has been one of their strengths. We've seen that in the series here," Pittsburgh manager Clint Hurdle said.
There would be no repeat outcome from the first three games of the series.
"It was resiliency," Roberts said. "We spot them four in the first, and (Kazmir) goes out there and throws up four zeroes and we responded. I liked the way we didn't quit."
Turner sought medical attention after taking a big swing in the ninth. He finished the at-bat but then left the game before the bottom of the ninth.
"I think it was just a cramp," Roberts said. "We'll get some fluids in him and see how he feels."
NOTES: For the getaway day game of the wraparound series, Los Angeles gave several regulars a day off from the starting lineup: C Yasmani Grandal, 1B Adrian Gonzalez, 2B Chase Utley, SS Corey Seager and CF Joc Pederson. ... Gonzalez, who was hitting .181 for June, was off for the second day in a row. He told the Los Angeles Times he asked for the time off to take a break from hitting. ... The Dodgers have not announced a starter for Wednesday's game against the Brewers. ... Pittsburgh SS Jordy Mercer, who left Sunday's game after getting kneed in the head on a slide into second, was in the starting lineup. ... Pirates RF Gregory Polanco (leg), who pinch-hit Sunday, remained out of the starting lineup. ... According to Elias Sports, Pirates RHP Chad Kuhl, the winner Sunday night, joined Archie Bradley as only pitchers to get a win vs. Dodgers ace Clayton Kershaw in their major league debut. Bradley did so last year with Arizona. ... The Pirates had a cross-country flight after the game. They play at Seattle on Tuesday. The Dodgers traveled to Milwaukee.