LOS ANGELES -- Manny Ramirez hadn't homered for 10 days, which meant he was due.
As it turned out, he was due twice.
Ramirez hit two homers and drove in five runs, Angel Berroa drew a two-out, bases-loaded walk in the seventh to force in the go-ahead run, and the Los Angeles Dodgers beat the San Francisco Giants 10-7 Saturday night to lower their magic number for winning the NL West to five.
Ramirez hadn't homered since Sept. 10, when he hit a pair in a 7-2 victory over the San Diego Padres.
"I'm just happy to be here, trying to go to the playoffs with this team," Ramirez said. "We've got to battle every game. I got a lot of good pitches to it and I drove it good."
By winning for the 16th time in 20 games, the Dodgers remained 3½ games ahead of second-place Arizona with seven remaining. Any combination of five Los Angeles wins or losses by the Diamondbacks will give the Dodgers their first division title since 2004 and just their fifth playoff berth in the last 20 years.
"Any way, any port in the storm at this point," Dodgers manager Joe Torre said. "The thing about it, it's what we do. We've got to assume we've got to win to get the magic number down to zip."
Ramirez hit a three-run homer off Brad Hennessey in the third and a two-run shot off Geno Espineli in the eighth for the 53rd multihomer game of his career. Ramirez, who has 526 lifetime homers to rank 17th on baseball's career list, has 16 along with 50 RBI and a .404 batting average in 47 games with the Dodgers. He has 36 homers and 118 RBI in 147 games overall this year.
"Nothing he does surprises anybody. I don't know where we'd be without him," said Matt Kemp, who also homered in the third inning for the Dodgers.
"He's a special player," Torre said. "They say the great players are able to slow down the game for themselves."
The game was tied at 5 when Ramirez walked and James Loney singled to start the seventh against Tyler Walker (4-8). After Casey Blake and Kemp hit into forceouts, pinch-hitter Nomar Garciaparra drew a walk against Jack Taschner to load the bases, and Berroa walked on four pitches to put the Dodgers ahead. Pinch-hitter Delwyn Young then drew another walk to cap an 11-pitch at-bat against Taschner, making it 7-5.
"I don't particularly walk a whole lot of guys, but it is what it is," said Taschner, who walked the only three batters he faced. "I don't worry about throwing around guys. I'm not trying to do that. I try to cover the zone, make my pitches and get them out. I couldn't care less if there's bases loaded or nobody on. You don't worry about where you're going to put them. You're worrying about getting them out."
After Ramirez's homer in the eighth, the Dodgers added another run on Berroa's infield out.
Takashi Saito (4-3), pitching for the third time since coming off the disabled list, worked a hitless inning to earn the win. He was sidelined for two months with a sprained ligament in his pitching elbow.
"This was not a good game for us," Giants manager Bruce Bochy said. "When you give up 10 or 11 walks, that's going to do you in."
The Dodgers had nine hits and drew 11 walks.
"That's been a problem at times for us, and tonight it was again," Bochy said. "I thought Tasch had good stuff, but he was just missing. We've got to pound the strike zone and throw quality strikes. That's one thing we've got to get better at. You're going to get beat, but when you beat yourself, that's what hurts."
The Giants took a 1-0 lead against Hiroki Kuroda in the first, but they could have scored more. The first three San Francisco batters singled to load the bases before Bengie Molina struck out, but Kuroda walked Travis Ishikawa to force in a run. Aaron Rowand then grounded into an inning-ending double play.
Ishikawa drove in another run in the third, this time when second baseman Blake DeWitt failed to come up with his one-out grounder for an error. Nate Schierholtz scored from third on the play, making it 2-0.
Ramirez's first homer and a two-run shot by Kemp, his 17th, gave the Dodgers a 5-2 lead.
The Giants chased Kuroda and tied the game 5-all in the fifth. Chan Ho Park relieved after a leadoff double by Molina, and failed to retire a batter, allowing one hit and two walks, the second to Eugenio Velez with the bases loaded to force in a run. Joe Beimel threw a wild pitch to allow another run to score before the tying run came home on pinch-hitter Scott McClain's infield out.
Hennessey, making just his third start this season, was lifted for a pinch hitter after giving up five runs and five hits in three innings. Kuroda allowed eight hits and three runs in four-plus innings with one walk and five strikeouts.
- The 4-hour, 3-minute game was played before an announced crowd of 55,724.
- Fourteen pitchers were used -- eight by the Giants and six by the Dodgers.
- Ramirez became the fifth player in big league history to hit at least 15 homers with two different teams in the same season, joining Fred McGriff, Mark McGwire, David Justice and Carlos Beltran.
- Sandoval, hitting .349 with three homers and 21 RBI in 34 games, didn't start because of a sore left quad.
- Hall of Famer Tom Lasorda, who managed the Dodgers from 1977-96 and is now a club executive, was presented with a giant birthday cake before the game. He turns 81 Monday.