SAN FRANCISCO — Buster Posey singled in the go-ahead run in the sixth inning and the Giants slowed down the surging A’s with a 7-1 victory on Friday night.

Madison Bumgarner pitched three-hit ball over six innings to win consecutive starts for the first time this season. Alen Hanson added two hits and Steven Duggar had two RBIs and scored twice.

The A’s had won 19 of 24 and took three of four from AL West-leading Houston before falling to their rivals from across the bay.

Oakland All-Star second baseman Jed Lowrie was forced out of the game with a left leg contusion following a collision with Stephen Piscotty while both chased Hanson’s fly ball to short right field in the third.

Lowrie’s status for Tuesday’s All-Star Game in Washington is uncertain. He was selected to the AL team as an injury replacement for Gleyber Torres of the New York Yankees.

Chad Pinder homered for Oakland.

Neither team did much offensively early and the Giants scored their first run on a balk by A’s starter Edwin Jackson (1-1) in the fourth.

Posey came through in the sixth.

Duggar drew a leadoff walk. After Brandon Belt struck out, Andrew McCutchen singled and Brandon Crawford popped up. Posey followed with a sharp single to left.

Posey was batting fifth for the first time this season as part of manager Bruce Bochy’s attempt to shake things up.

Bumgarner (3-3) allowed one run with five strikeouts in his third consecutive win against the A’s. The left-hander retired 14 in a row during one stretch and left after giving up a single and two walks in the seventh.

Reyes Moronta replaced Bumgarner and retired three in a row to get out of the jam.

Jackson yielded two runs over six innings but lost in his second attempt at his 100th career win. Jackson struck out five and walked three.

TRAINER’S ROOM

Athletics: Khris Davis did not start because of a sore left shoulder but played left field after Piscotty moved to second when Lowrie was removed. ... RHP Josh Lucas was optioned to Triple-A Nashville. LHP Jeremy Bleich was called up.