Updated

San Francisco, CA (SportsNetwork.com) - Carl Crawford lined an RBI triple to highlight Los Angeles' three-run fifth inning and the Dodgers beat the San Francisco Giants, 4-3, to sweep a three-game set.

Hanley Ramirez went 2-for-4 with an RBI and run scored for the Dodgers, who moved 1 1/2 games ahead of the Giants for first place in the NL West.

"We're going to see these guys again. They're not going anywhere," Dodgers manager Don Mattingly said.

Hyun-Jin Ryu (12-5) struck out seven and allowed three runs on six hits and a walk over six innings to notch the win.

Jake Peavy (0-1), who was acquired from the Boston Red Sox on Saturday, made his first start for his new club and yielded four runs -- three earned -- on six hits and two walks while fanning five for San Francisco, which has dropped four straight on the heels of a 6-1 stretch.

Buster Posey smacked a solo homer in defeat.

The Giants led 2-1 before the Dodgers surged ahead following their three-run fifth.

Dee Gordon reached first with one out on a wild pitch third strike and Yasiel Puig walked prior to a Peavy wild pitch that advanced both runners to second and third.

Adrian Gonzalez struck out for the second out, but Gordon scored on Posey's throw to first on another wild pitch. Ramirez then whacked a base hit up the middle to plate Puig and Ramirez scored when Crawford ripped a triple into the right-field corner to give the Dodgers a 4-2 cushion.

San Francisco got a run back in the fifth when Posey launched his solo shot on a 3-0 fastball into the seats in left, trimming the deficit to 4-3.

The Giants never put a runner in scoring position the rest of the way. Brian Wilson tossed a scoreless eighth and Kenley Jansen struck out the side in the ninth to record his 30th save of the year.

"We just couldn't do much late in the ballgame," Giants manager Bruce Bochy said.

Earlier, San Francisco opened the scoring in the third on Hunter Pence's two- out RBI single, but the Dodgers tied the game in the fourth when Juan Uribe hit a run-scoring single through the hole on the left side.

The Giants went back in front in the home half on Brandon Crawford's RBI single to left.

Game Notes

The Dodgers went 2-for-8 with runners in scoring position, while San Francisco finished 2-for-5 ... Peavy went 1-9 with a 4.72 ERA in 20 starts for Boston this year. The trade also reunites Peavy with Giants manager Bruce Bochy, who managed him with the San Diego Padres from 2002-06.