SAN FRANCISCO — Justin Turner hit a go-ahead, two-run homer in the fifth inning and the Los Angeles Dodgers moved to the brink of securing baseball’s final playoff berth by beating the San Francisco Giants 3-1 on Friday night.

The Dodgers remained one game behind NL West-leading Colorado. They also extended their lead to two games over St. Louis for the second NL wild-card spot with two left to play.

Hyun-Jin Ryu (7-3) allowed one run on four hits over six innings to win his third straight start. He gave up Nick Hundley’s leadoff homer in the second but the defense then backed its pitchers by turning five double plays — including one to end the game.

Kenley Jansen, the fifth Dodgers reliever, finished for his 38th save.

Turner’s homer off Madison Bumgarner (6-7) broke a 1-all tie.

Bumgarner asked to push back his scheduled Wednesday start against San Diego to pitch a game in the final weekend that mattered against the contending Dodgers. He gave up three runs on seven hits in six innings, struck out six and walked one.