"That was quite a run," D-backs manger Bob Melvin said. "We finally got him out. He's up there with nobody on leading off innings still hitting home runs and hitting balls the other way for home runs. It's quite a roll he's on."
With the win, the Dodgers (66-70) snapped an eight-game losing streak and won their first game on their 10-game road trip. The D-backs (69-66) now lead the Dodgers by 3 1/2 games in the National League West.
D-backs starting pitcher Dan Haren wasn't pitching in his typical fashion, as he gave up five runs on 10 hits in six innings, picking up the loss. He allowed two homers -- a solo shot to Ramirez and a two-run homer to Matt Kemp in the fifth inning.
"Even though I'm not walking guys, my command just isn't there," Haren said. "I'm throwing plenty of strikes, but the strikes I'm throwing just aren't as quality as they've been in the past. I'm battling through a little bit of some funk with mechanics. I just don't feel exactly right out there. My arms feels great, but there's something wrong. I just wasn't able to correct it today.
"It's frustrating, obviously, playing the Dodgers and not really having great stuff."
Dodgers starter Chad Billingsley was solid, throwing seven innings of two-run ball, allowing nine hits. He was touched up only by Chris Young, who had three hits off the right-hander and had the team's only two RBIs.
Young had an RBI triple, scoring Haren, who reached on a fielder's choice, in the third inning. He added an RBI double in the eighth after Stephen Drew led off the inning with a double.
"Billingsley hit his spots," Young said. "He pitched a good game, no doubt. He kept us all off-balance. He pitched a good game no matter what I did."
Billingsley, who set his career high with his 13th victory of the season, also got a single in fourth inning off Haren.
Ramirez's first home run was smacked 394 feet over the left-field wall on the first pitch. His second was another solo shot off the right-field foul pole in the seventh off Juan Cruz. Ramirez was just a triple away from the cycle. His double in the fifth inning was the 500th of his career.
Melvin said teams may be starting to figure out how to game plan for Haren after seeing him several times this season. He struggled in August, compiling a 5.63 ERA in six starts, allowing six homers. Haren has seen his ERA rise from 2.62 to 3.24.
"He gives up his share of hits, maybe the last four or five starts out more than we've seen, so he probably needs to make an adjustment if guys are swinging a little bit earlier on him," Melvin said. "It's just making some adjustments knowing that the game plan for other teams has probably changed a little bit for him."
In his career, Ramirez is hitting .529 (9-for-17) off Haren.
"He's hit me pretty well in the past," Haren said. "I've had games where I've gotten him out. He's one of the greatest right-handed hitters ever. When he's locked in, he's locked in. Sometimes you catch him at a good time or bad time.
"I didn't really make two great of pitches to him, to be honest. I hung a split and he hit it down the line. The fastball, although it was down, it wasn't away and he hit a homer, and I left a ball over the plate and he hit it for a single, so it was a matter of executing pitches for me. If I get the ball where I want it to be, I'm pretty confident I can get him out."