SAN FRANCISCO — The Colorado Rockies’ bats went silent at the worst possible time.

Madison Bumgarner pitched six strong innings, and Austin Slater and Hunter Pence drove in runs as the San Francisco Giants beat Colorado 3-0 Saturday night and knocked the Rockies out of first place in the National League West.

The Rockies slipped a half-game behind the Dodgers in the division. Los Angeles beat St. Louis 17-4 Saturday.

The Giants shut out Colorado for the second straight game after starting the month of September with 11 straight losses, their worst winless stretch since moving to San Francisco.

“Obviously you never want to get shut out, especially not two games in a row,” Rockies shortstop Trevor Story said. “There’s some (frustration), a little bit, but definitely no panic.”

The Rockies lost for the sixth time in seven games at AT&T Park. They’ve been shut out two straight games 15 times in franchise history, 13 times by the same team.

The Rockies were 0 for 10 with runners in scoring position. They’ve been held scoreless for 19 straight innings, dating to Thursday’s game against Arizona.

Bumgarner (6-6) struck out two, walked one and hit a batter in winning for the second time in eight starts. He extended his consecutive scoreless innings streak at home to 20.

Bumgarner left the game with tightness on his side, which he felt during his last at-bat in the fourth, manager Bruce Bochy said.

Bumgarner is expected to make his next start.

“He was being honest and being smart,” Bochy said. “He said ‘Could I keep going? Yes. Do I feel it? Yes.’”

Relievers Tony Watson, Mark Melancon and Will Smith combined for three innings of two-hit ball for the Giants. Smith worked the ninth for his 12th save.

“What a great job by this staff in back-to-back games against a good hitting lineup,” Bochy said. “Back-to-back shutouts are pretty impressive by this staff.”

The Giants were held to three runs or fewer in 16 of their last 18 games and 10th straight, the team’s longest such streak since 2002, when they went 11 in a row. (Aug. 14-18).

Slater drove in a run with an infield grounder, and Pence had an RBI single in a two-run second inning off Rockies starter German Marquez (12-10).

Bumgarner, who doubled leading off the third, scored the Giants’ third run on a wild pitch.