Ryu (14-7) allowed one run on four hits and a walk over seven innings to help Los Angeles win for the fifth time in the past seven games.
Yasiel Puig and Matt Kemp hit solo home runs to account for the Dodgers' runs and two of the team's eight hits. Kenley Jansen pitched the ninth for his 28th save.
Tony Abreu lined a solo home run into the seats in the fifth inning, which tied the game 1-1. But Kemp led off the sixth with his sixth homer of the season to put Los Angeles back in front.
Matt Cain (8-10) took the loss for the Giants, who had won six of their previous nine games. Cain allowed two runs on seven hits and three walks over seven innings.
NBC reportedly holds celebs hostage to Jimmy Fallon's show
Aaron Carter is still in love with Hilary Duff