CHICAGO — Brandon Crawford is working on a strong finish to a terrific May.

In the field, and at the plate.

Crawford hit a two-run homer, Brandon Belt drove in two runs and the Giants beat the Chicago Cubs 5-4 on Saturday night to stop a three-game slide.

Crawford went 2 for 3 to improve his May batting average to .446 (37 for 83). The slick-fielding shortstop, who made a strong jumping throw to retire Willson Contreras in the fourth inning, has four homers and 20 RBIs in 23 games this month.

“That’s what I’m here for is to play defense,” Crawford said. “Fortunately, I’ve made adjustments at the plate to be a threat at the plate, too.”

Crawford’s opposite-field drive off Jose Quintana on a high 3-2 pitch landed in Wrigley’s Field’s left-field basket for his sixth homer, tying it at 2.

“Only few parks in baseball I would have thought that had a chance,” Crawford said. “Fortunately this is one of them.”

Andrew McCutchen had two hits and drove in a run as San Francisco won for the first time on an eight-game trip. Chris Stratton (6-3) shook off a shaky start and lasted five innings for his third consecutive win.

Chicago lost for the third time in four games. Javier Baez hit his team-leading 12th homer, and Kyle Schwarber homered, doubled and scored two runs.

The Cubs blew leads of 2-0 and 3-2. Quintana (5-4) struck out six through three scoreless innings, and then faded and was charged with four runs and five hits in just 4⅓ innings.

Stratton issued each of his three walks in the second, including four balls in a row to Jason Heyward that forced in the game’s first run. But Stratton wriggled out of the jam, getting Quintana to bounce into an inning-ending double play.

The right-hander allowed three runs and four hits with six strikeouts.

Schwarber hit his ninth homer in the third, but Crawford responded with his drive in the fourth.

After Baez connected in the bottom half, San Francisco went ahead to stay with two in the fifth. McCutchen hit a tying RBI double and scored on Belt’s two-out single.

Belt made it 5-3 with a sacrifice fly in the seventh, driving in Gorkys Hernandez.

The Cubs got one back on Anthony Rizzo’s RBI single in the eighth, but the rally fizzled from there. Hunter Strickland pitched a perfect ninth for his 10th save in 12 chances.

TRAINER’S ROOM

Giants: C Buster Posey (right hip soreness) was held out. He is day to day. “He’s had some history of this and then it clears up,” manager Bruce Bochy said. ... LHP Madison Bumgarner (fractured pinkie) was impressive in his first rehab start for Triple-A Sacramento, striking out eight while pitching 3⅔ hitless innings. Bumgarner likely will make two more starts in the minors, Bochy said. ... 2B Joe Panik (sprained left thumb) will begin a rehab assignment with Sacramento on Monday.