CHICAGO — Madison Bumgarner facing Jake Arrieta had an October feel to it, and the San Francisco Giants performed like they belong in the postseason.

Bumgarner outpitched Arrieta with 10 strikeouts over six innings, and San Francisco pounced on rare miscues by the Chicago Cubs in a 3-2 victory on Saturday.

Bumgarner (14-8) allowed two runs and five hits in his fourth victory in his last five starts. San Francisco, trying to catch Los Angeles in the NL West, rebounded from a pair of one-run losses in the first two games of the four-game set against the major league leaders.

“We’re going up against a team that, I don’t think they’ve clinched yet, but they’re going to be there,” Bumgarner said. “And we’re planning on being there. So it’s a playoff-type of matchup.”

The Giants had a major league-best 57-33 record at the All-Star break. But they are just 16-29 since that point, leaving them looking up at the Dodgers and clinging to the top spot in the wild-card race.

“It was one we definitely wanted and needed,” catcher Buster Posey said. “It was good to score some runs off Arrieta and then for our bullpen to hold the lead.”

Arrieta (16-6) was charged with three runs — two earned — and four hits in six innings in his first loss since July 30. Chicago had won five in a row overall.

“A little bad luck, a little missed execution,” Arrieta said.

The Cubs had one last chance when pinch hitter Anthony Rizzo led off the ninth with a walk against Will Smith. Rizzo advanced on a sacrifice by Dexter Fowler, but the big first baseman was caught off second on the play.

“That’s huge,” Giants manager Bruce Bochy said. “Heart of the order up, man on second, it’s a different game.”

Kris Bryant then hit a soft lineout to shortstop Brandon Crawford, handing Santiago Casilla his 30th save.

Chicago also had an opportunity in the sixth, but Bumgarner struck out Matt Szczur for the third time with two on. Hunter Strickland got Addison Russell to line to right with the bases loaded in the seventh.

The sputtering Giants had dropped three of four and eight of 12 overall.

“Right now as bad as it seems, we’re still in a better spot than we were in 2014,” Bumgarner said of their last World Series title season. “We’ve still got the division in our sights for sure.”

The Cubs entered with a 16 1/2-game lead in the NL Central thanks to a number of tremendous defensive plays in the past week. But they were sloppy on a cloudless day with the wind blowing in as two of the game’s top pitchers squared off.

Third baseman Tommy La Stella’s two-out throwing error in the first made it 1-0. The Giants scored in the fourth with the help of a passed ball and added a run in the sixth on Arrieta’s second wild pitch.

The Cubs got within 2-1 in the fifth thanks to Javier Baez’s hustle. He led off with a single, stole second and scored from there when third baseman Eduardo Nunez was unable to barehand Arrieta’s slow roller.

Angel Pagan doubled and scored on the error by La Stella, who was a late addition after Jorge Soler was scratched with an ingrown toenail. Soler hit for La Stella in the fifth and struck out with one on.

The Giants took a 2-0 lead on Nunez’s RBI single in a fourth that included a walk and wild pitch by Arrieta and Willson Contreras’ passed ball.

“It’s not very common with our group of guys,” Arrieta said of the mistakes. “You don’t expect to see those things often. We had opportunities regardless.”

TRAINER’S ROOM

Giants: Reliever Derek Law (elbow) hasn’t begun throwing yet, but Bochy said they “expect him to be at full strength” when he’s eligible to come off the disabled list Sept. 12.

Cubs: Setup man Hector Rondon (triceps) threw a 22-pitch simulated game and felt good enough that his rehab stint at Triple-A Iowa was scrapped. Rondon could be activated Monday. “I’m back to normal,” he said.

STREAK OVER

Giants 1B Brandon Belt dropped Ben Zobrist’s two-out popup in the first to stop the longest errorless streak in franchise history at 17 games.

UP NEXT

RHP Johnny Cueto (14-5, 2.98 ERA) looks to rebound from his shortest stint with the Giants when he faces Cubs RHP John Lackey (9-7, 3.41 ERA) on Sunday.