LOS ANGELES — Wilmer Flores hit a go-ahead, two-run homer off closer Kenley Jansen in the ninth inning and the San Francisco Giants rallied past the Los Angeles Dodgers 4-2 on Wednesday night.

Mike Yastrzemski homered early to help the Giants regain a two-game lead in the NL West over the defending World Series champions. San Francisco has won two of three in a four-game series between the longtime rivals that wraps up Thursday night.

The Giants had just four hits before Flores' drive, which quieted the sellout crowd at Dodger Stadium. Buster Posey delivered a pinch-hit single to start the ninth, and Flores followed with a two-run shot to left field that put San Francisco in front 3-2.

It was the 11th homer of the season for Flores. Jansen (1-3) fell to 21 for 25 in save opportunities.

Victor Gonzalez walked Curt Casali with the bases loaded, making it 4-2.

Tyler Rogers, who took the loss Tuesday after allowing a game-ending homer to pinch-hitter Will Smith, earned his 11th save by pitching a scoreless ninth.

Jose Alvarez (3-1) worked a scoreless inning for the win.

Dodgers manager Dave Roberts was ejected in the ninth.

Los Angeles starter Julio Urías pitched a gem, allowing just three hits in seven innings. He struck out five and walked one.

Urías gave up Yastrzemski's home run but otherwise silenced the Giants. He was trying to become the first 13-game winner in the majors.

Yastrzemski hit his 16th home run in the first inning and second in two days.

Chris Taylor responded with a solo homer of his own in the bottom of the first. Taylor is having a terrific July and has three home runs in his last two games. He’s hit safely in 14 of the last 17 games.

Cody Bellinger made a fantastic sliding catch in centre field for the Dodgers to rob Austin Slater of a hit in the third.

AJ Pollock hit an RBI double to the right-field corner off Logan Webb in the fourth to score Bellinger and give Los Angeles a 2-1 lead.

Webb allowed two runs and three hits in five innings.

HOME RUN CITY

The teams have combined for 37 home runs in nine games at Dodger Stadium this season. They have a combined 14 in the series, tied for the second-most in a four-game series in this rivalry.

TRAINER’S ROOM

Dodgers: OF Mookie Betts (hip pointer) was not in the starting lineup for the fourth consecutive game and could land on the injured list, Roberts said. ... 3B Justin Turner (shoulder) was not in the starting lineup after getting hit by a pitch from Alex Wood on Tuesday. Roberts said Turner was going to get the night off anyway. Turner pinch hit in the ninth.

UP NEXT

Giants: RHP Anthony DeSclafani (10-4, 2.78 ERA) gave up five hits and three runs (all solo homers) in five innings in his last start against the Dodgers on June 28.

Dodgers: RHP Walker Buehler (10-1, 2.37) has been dominant against the Giants this season, going 2-0 with a 0.92 ERA in three starts. He’s 6-0 with a 2.17 ERA in 10 career games versus San Francisco.

___

More AP MLB: https://apnews.com/hub/MLB and https://twitter.com/AP_Sports