"You've got to battle sometimes, you won't throw up zeroes every time," said Kershaw. "Games like this are going to happen."
Kershaw, 5-3, allowed seven hits and three walks in seven innings with five strikeouts, his ERA climbing from 1.35 to 1.68.
But the Cardinals showed why they have the best record in the Majors by punishing Kershaw for the two walks he issued in the third inning, both of them scoring on Kozma's three-run double inside third base.
St. Louis scored a fourth run in the seventh inning on Kozma's bloop double off the glove of a diving Dee Gordon in shallow center and a Matt Carpenter line single off the glove of first baseman Gonzalez.
"Guys came in today and were talking about fighting," said Cardinals manager Mike Matheny. "That's exactly what they did. They realized that when you face a pitcher like a Kershaw, he's not going to give you much. You have to scratch and claw for what you get."
That fourth run snapped Kershaw's streak of 22 consecutive starts in which he allowed three earned runs or less. The last time it happened was also against the Cardinals, last July 24. It was the longest such streak for a Dodger starter since Orel Hershiser in 1985-86.
"They hit balls to spots where guys weren't more than we did today," said Kershaw.
The only Dodger who found a good spot for a ball to land was Gonzalez, who staked Kershaw to the 2-0 lead with a first-inning homer, his second blast in as many games. Gonzalez has 36 RBIs, more than double the next highest on the team (Kemp's 17).
Speaking of Kemp, he was left out of the starting lineup by manager Don Mattingly, who triggered a firestorm of controversy when he did the same to Andre Ethier in Milwaukee on Wednesday and followed it by challenging his club to show more grit and fight, the implication being that Ethier was the prime offender.
This benching, Mattingly said, was needed because Kemp was struggling, the Cardinals were throwing tough right-hander Shelby Miller and Kemp just needed a break. It was not accompanied by any criticism, although it came one day after Kemp was seen complaining in the dugout after being removed in a double-switch.
On Sunday, Mattingly used Kemp as a pinch-hitter with one out in the bottom of the eighth after Gordon's daring bunt single on a 2-2 pitch. But Kemp grounded sharply into an inning-ending double-play, his eighth of the season.
"He squared the ball good," Mattingly said of Kemp, who left the clubhouse before reporters were allowed in.
Kershaw had the same double-play outcome when Mattingly let him bat with one out and the bases loaded in the bottom of the sixth inning, Kershaw having already thrown 95 pitches.
"He's our guy," Mattingly said of his decision to let Kershaw hit. "There's still one-third of the game left. We used our bullpen yesterday and I thought he'd put the ball in play and not thought he'd hit into a double-play."
An inning earlier, Kershaw turned an infield single into the tying run, scoring on Gonzalez's third RBI, a bloop single.
The Dodgers had plenty of scoring chances and went 1-for-8 with runners in scoring position. Their best late chance was in the bottom of the seventh after Carl Crawford doubled for his third hit and was bunted to third by Mark Ellis.
Trevor Rosenthal came on to face Andre Ethier, who was hit on the right thigh by a 98-mph fastball to load the bases. Rosenthal then struck out A.J. Ellis -- on a 100-mph fastball -- and Skip Schumaker on a 98-mph heater.
Ellis has struck out in seven of nine at-bats since bruising his right arm in Friday night's home-plate collision with Jon Jay. After being hit by a Miller pitch Sunday, he now has a matching bruise on his left arm, although X-rays taken after the game were negative.
Mattingly said if the Cardinals had brought in a lefty in the seventh inning, he would have used Kemp there.
As for Kershaw, alarm bells went off in the second inning when he allowed no-out walks to Yadier Molina and Daniel Descalso, sandwiched around a broken-bat double by David Freese to load the bases for Kozma's three-run double.
"Two walks scored," said Kershaw. "Definitely my fault there. I walked three guys. Obviously, it wasn't great command."