The San Francisco Giants have built the best record in the majors with a sound defense and one of the top bullpens in the National League.

On this night, though, it was smart baserunning and a couple of calls that allowed them to extend their lead over the Los Angeles Dodgers in the NL West.

LaMonte Wade Jr. broke a ninth-inning tie with a two-run single and San Francisco rallied against closer Kenley Jansen again for a 5-3 victory over the Dodgers on Thursday.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

The Giants trailed 3-1 going into the ninth before scoring four times to increase their division lead to three games over the defending World Series champions. San Francisco (61-35) took three of four in a tense series between the longtime rivals that saw the final three games decided in the ninth inning.

"This series shows a lot about our team and shows we can play on both sides of the ball with the best of them. We have to keep that mentality throughout," Wade said.

Before his clutch single, the Giants were able to tie it at 3 on two key plays in the ninth.

Jason Vosler got a good lead off first base with the bases loaded and beat shortstop Chris Taylor's throw to second on an infield single by Thairo Estrada. That kept the game going and scored Wilmer Flores to bring San Francisco to 3-2.

Vosler was initially ruled out at second for the final out, but the call was overturned following a replay review.

Giants manager Gabe Kapler said Vosler's lead off first and beating the throw was the most important play of the game.

"(Max) Muncy was playing pretty far off the bag," Vosler said. "I was trying to get the biggest primary lead that I could and make sure I got to second on the ground ball. That makes the difference."

Darin Ruf then checked his swing on a full-count cutter — although replays appeared to show he went around — to draw a walk from Jansen that forced in the tying run.

Dodgers manager Dave Roberts yanked off his cap and argued vehemently, leading to him being ejected in the ninth inning for the second consecutive night.

"There’s no doubt in my mind that he went and the game should have been over. In that spot with two contending teams you just can’t miss that call," Roberts said. "We should have won that game and it's a game we really wanted, we had, and we didn't."

Wade then hit a sinking liner to right field that dropped just in front of newly acquired Billy McKinney, giving San Francisco a 5-3 advantage.

Jansen was lifted to a chorus of boos for the second straight night.

"You have to be able to hit the mistake pitch and luckily tonight that was the first pitch of the at-bat. When you get it, you try not to miss," Wade said.

Jansen (1-4) fell to 21 for 26 in save opportunities. He has allowed seven runs on seven hits with four walks in one inning over the past two games.

Roberts was steadfast that Jansen will remain his closer.

"I don’t think all the blame should be on Kenley. The game should have been over a couple times in that inning," Roberts said.

José Álvarez (4-1) got the win and Jake McGee pitched the bottom of the ninth for his 20th save.

Will Smith hit a two-run homer off Anthony DeSclafani, and Walker Buehler allowed one run in 7 1/3 innings for the Dodgers.

The Giants took a 1-0 lead in the first when Wade scored on Mike Yastrzemski's sacrifice fly. The Dodgers evened it in the bottom half when the first three batters got base hits off DeSclafani, including Justin Turner's single to drive in Taylor.

THEY LOVE LA

By taking the series, the Giants finished 6-4 at Dodger Stadium this season, marking the first time since 2014 they had a winning record at Chavez Ravine.

The teams have a three-game series beginning Tuesday in San Francisco before playing their final series of the season Sept. 3-5.

"We’re enjoying the fact we played a good series, but we're already thinking about playing Pittsburgh," Kapler said.

FOR STARTERS

Buehler tied his season high by going 7 1/3 innings. The right-hander struck out nine and allowed five hits. Buehler has gone at least six innings in all but one of his last 22 starts dating to last season, including the postseason.

DeSclafani yielded two runs on six hits in six innings with seven strikeouts.

TRAINER'S ROOM

Giants: 1B Brandon Belt (right knee inflammation) will begin running the bases this weekend. ... 2B Tommy La Stella (left hamstring strain, right thumb) went 2 for 2 and RHP Aaron Sanchez (right bicep tightness) allowed four runs in 5 1/3 innings during rehab assignments at Triple-A Sacramento.

Dodgers: Muncy will go on paternity leave beginning Friday and miss the Colorado series. ... RHPs Corey Knebel (right lat strain) and Jimmy Nelson (back) both pitched an inning during a simulated game. Roberts said Nelson could be activated this weekend.

UP NEXT

Giants: Begin a nine-game homestand Friday against Pittsburgh. RHP Johnny Cueto (6-5, 4.01 ERA) has gone 0-2 in his last three starts and will be opposed by Pirates RHP Chad Kuhl (3-5, 4.31).

Dodgers: Continue their homestand against Colorado on Friday. LHP David Price (4-0, 3.12 ERA) allowed one run in four innings last Sunday against the Rockies. RHP Chi Chi Gonzalez (3-6, 5.99) takes the mound for Colorado.