Mattingly wanted to check on his ace, who after rolling through the first five innings, gave up two two-out hits.
"These guys are great hitters," Kershaw said. "They made me work the last inning. It's definitely different than a normal game because you're playing the team behind you."
Kershaw struck out 15 to set a season career high with 251 and Chase Utley hit a go-ahead homer in the sixth to complete a three-game sweep of the Giants.
"I'm sure they're happy now," Giants second baseman Kelby Tomlinson said, "but hopefully we can put it together and be the ones celebrating at the end."
The second-place Giants' fifth straight loss left them facing their largest division deficit of the season. All three defeats to the Dodgers were by one run and they have scored just 11 runs during their skid.
"Stranger things have happened," said Giants manager Bruce Bochy, who was ejected for the second straight game. "Trust me. There's a lot of baseball left."
Kershaw (12-6) beat the Giants for the first time in four starts this season. He allowed one run and six hits and walked one on a career high-tying 132 pitches for his third complete game of the season.
"That's what you want to see from one of your horses," catcher Yasmani Grandal said. "He wanted to finish out the game."
Kershaw leads the National League in strikeouts, surpassing his career-best of 248 set in 2011. His 15 strikeouts tied a career high after having 14 against the Cubs in his previous start.
"He had 15 strikeouts? Wow," Mattingly said. "He laid the gauntlet down in the sense that it's that time of year. If you got these guys down at all you want to keep them there."
Kershaw created suspense for a crowd of 41,648 that was on its feet in the ninth. With two outs, the Giants put the tying and go-ahead runs on base after Matt Duffy and Buster Posey had consecutive singles. Kershaw pumped his arms after striking out Byrd.
"We're a good team and we're starting to play like that day in and day out," Kershaw said. "We can't relax, we got to keep our foot on the gas pedal."
Kershaw became the first NL pitcher to strike out 250 batters in a season since Tim Lincecum of the Giants fanned 261 in 2009.
"He just pounded the strike zone," Bochy said. "We were behind in the count it seemed like every hitter. He's got some weapons out there."
Mike Leake (9-7) gave up two runs and five hits in seven innings, struck out three and walked none. He is winless in five starts since the Giants acquired him from Cincinnati on July 30.
"He's going to keep it to a one-run game," Leake said of Kershaw. "It's not added stress, but it's a fun challenge. Unfortunately, we came out on the losing end."
Kershaw's performance gave the Dodgers' oft-shaky bullpen a rest after it came up big in the series' first two games, a 5-4, 14-inning win Monday and a 2-1 victory Tuesday.
Utley's first homer as a Dodger put the team ahead for good, 2-1.
The Giants tied the game 1-all in the sixth on a RBI single by Angel Pagan.
Los Angeles led 1-0 on Carl Crawford's RBI double in the second.
Bochy was ejected in the dugout after Brandon Belt struck out leading off the eighth. He claimed it was a checked swing and appealed to third base umpire Mike Winters, who tossed Bochy before the manager came onto the field to argue in person.
Giants: RHP Matt Cain (elbow nerve irritation) will pitch a couple of rehab innings Friday at Triple A-Sacramento. ... INF Joe Panik (low back inflammation) will start his rehab stint Thursday at Sacramento. He's likely to play three games there and possibly re-join the team for its series at Arizona next week.
Dodgers: INF Howie Kendrick, on the DL since Aug. 20 with a strained left hamstring, is still not ready to return.
Kershaw's 15 strikeouts were the most by a pitcher in any game against the Giants since Houston's Nolan Ryan had 16 on Sept. 9, 1987. Kershaw improved to 1-2 with a 2.76 ERA in four starts against San Francisco.
Posey went 3 for 4, raising his career average to .233 against Kershaw, who he has faced more than any other pitcher in his career. Posey is hitting .429 with a double, three homers and 11 RBIs in 15 games against the Dodgers this season.
Giants: RHP Ryan Vogelsong (9-10, 4.19 ERA) starts the opener of a four-game series at Colorado, where he is 3-3 with a 7.14 ERA in six career starts. He's made it through the sixth inning just once in his last seven starts.
Dodgers: RHP Mat Latos (4-9, 4.76) starts the opener of a four-game series at San Diego. He is 0-2 in four career starts against the Padres with a 2.08 ERA while holding batters to a .189 average.