Two days after being acquired from Miami in a trade meant to boost the Dodgers' offence and playoff hopes, the slugging infielder went hitless in his first four at-bats against the Giants before homering to left-centre on an 0-1 pitch from reliever Sergio Romo (3-2).
Andre Ethier, who walked ahead of Ramirez's home run, had two hits and scored twice to help pull Los Angeles within two games of first-place San Francisco. James Loney and Juan Rivera also had two hits apiece for the Dodgers.
Ramirez's 15th home run extended a stellar start to his Los Angeles career. He had three hits in the first two games with his new club and is batting .364 since the trade.
Kenley Jansen gave up singles to Melky Cabrera and Buster Posey to open the bottom of the 10th. Jansen struck out the next two batters and then got Joaquin Arias to fly out for his 20th save.
Shawn Tolleson (1-0) pitched one inning for his first win in the majors.
CARDINALS 9, CUBS 6
CHICAGO (AP) — Matt Holliday, Yadier Molina and Lance Berkman were part of St. Louis' power show as the Cardinals became the first team in eight years to hit a home run in each of the first five innings and went on to beat the Chicago Cubs.
Matt Carpenter and Allen Craig also connected off Travis Wood (4-6), whose five homers allowed matched the Cubs record.
Carpenter put St. Louis ahead 7-6 when he homered on the first pitch of the fourth, and Craig homered in the fifth. The previous team to homer in each of the first five innings was Houston against Colorado on Oct. 2, 2004, according to STATS LLC.
Lance Lynn (13-4) allowed six runs and eight hits in five innings. Jason Motte got three outs for his 23rd save as St. Louis won for the seventh time in eight games.
Rookie Anthony Rizzo hit a two-run homer for the Cubs, his sixth in 25 games since he was brought up from Triple-A.
BRAVES 6, PHILLIES 1
ATLANTA (AP) — Brian McCann hit a three-run homer off Cole Hamels, and Ben Sheets extended his impressive comeback to lead Atlanta past Philadelphia.
Hamels (11-5), making his first start since signing a six-year, $144 million contract on Wednesday, set a career high with six walks in his shortest start of the season. He allowed five runs, three earned, on four hits with seven strikeouts in five innings.
The loss ended Philadelphia's four-game winning streak and cost the Phillies a chance to move out of last place in the NL East.
Sheets (3-0) won his third straight start, allowing one run, six hits and one walk with four strikeouts in six innings. He didn't allow a run while winning his first two starts in his comeback with Atlanta.
PIRATES 6, ASTROS 5
HOUSTON (AP) — Drew Sutton scored on a wild pitch by Xavier Cedeno in the ninth inning to propel Pittsburgh over hapless Houston.
The Astros (34-67), who own baseball's worst record, tied the club mark with their 11th straight loss — matching a run in 1995. They have lost 24 of 26 overall.
Houston led 5-4 entering the ninth inning before rookie Starling Marte's bases-loaded sacrifice fly tied it. It was the third time in four games that Houston has lost after entering the ninth with a lead.
Tony Watson (5-1) pitched a scoreless eighth for the win, and Joel Hanrahan earned his 31st save.
Alex Presley hit a solo home run for Pittsburgh in the fourth and Michael McKenry, who finished with three hits, connected for a two-run shot in the fifth.
Rhiner Cruz (1-1) came in for Houston with one out in the ninth inning and took the loss.
PADRES 7, MARLINS 2
MIAMI (AP) — Miami natives Yasmani Grandal and Yonder Alonso powered San Diego over the host Marlins.
Grandal hit a bases-clearing triple, and Alonso drove in two runs to back the pitching of Kip Wells (2-3).
Carlos Zambrano (5-9) allowed five runs — four earned — and three hits in five innings as the slumping Marlins lost for the eighth time in nine games.
Jose Reyes hit an RBI triple, and Carlos Lee drove him in with a hit to stake the Marlins to a 2-0 lead in the fourth inning, but they couldn't hold it.
San Diego scored five runs in the sixth to turn the game around.
BREWERS 6, NATIONALS 0
MILWAUKEE (AP) — Corey Hart and Aramis Ramirez homered to back another fine pitching performance by Mike Fiers, and Milwaukee snapped a seven-game losing streak with a victory over Washington.
Hours after trading ace Zack Greinke to the Los Angeles Angels for rookie shortstop Jean Segura and two Double-A pitchers, the Brewers ended Washington's six-game winning streak.
Called up May 29 from Triple-A Nashville, Fiers (4-4) has been one of Milwaukee's most consistent pitchers in recent weeks. He didn't allow a hit until the fourth inning and retired 14 of his first 17 batters.
Fiers gave up four hits and struck out nine in 6 1-3 innings. Over his last seven starts, he has allowed four earned runs in 47 innings for a 0.77 ERA.
Ross Detwiler (5-4) lasted 4 2-3 innings for the Nationals, giving up four runs and seven hits.
REDS 3, ROCKIES 0
DENVER (AP) — Bronson Arroyo pitched effectively into the seventh inning, Ryan Ludwick scored twice, and Cincinnati beat Colorado for its eighth straight victory.
Ludwick, Scott Rolen and Ryan Hanigan had two hits apiece for the Reds, who have won 12 of 14 since the All-Star break and tied Washington for the best record in the National League.
Aroldis Chapman worked the ninth for his 20th save in 24 chances.
Carlos Gonzalez and Jordan Pacheco each had two hits for the Rockies, who have lost seven of nine.
Arroyo (6-6) retired his first 11 batters before Gonzalez singled with two outs in the fourth. The right-hander left with two on in the seventh, but Alfredo Simon retired pinch-hitter Eric Young Jr. to end the threat. Arroyo allowed six hits and struck out three in 6 2-3 innings. It was the first time this season he won back-to-back starts.
Drew Pomeranz (1-6) took the loss after giving up three runs and seven hits in 5 1-3 innings.
DIAMONDBACKS 11, METS 5
PHOENIX (AP) — Josh Collmenter pitched six innings and drove in a run during Arizona's six-run second and the Diamondbacks beat the reeling New York Mets.
Willie Bloomquist had two RBI singles for the Diamondbacks, who have won six of seven.
Collmenter (3-2), who allowed five runs, seven hits and a walk with five strikeouts, got stronger as the game continued. He retired his final seven batters.
Ike Davis and David Wright homered for the Mets, who have lost 13 of 15.
Jonathon Niese (7-5) turned out to be his own worst enemy. After loading the bases in the second with a two-run lead, he walked Henry Blanco to cut New York's lead to 2-1 and Collmenter singled to tie the game.
Bloomquist followed with a ground ball near the third-base line. Niese sprinted off the mound to corral the ball, spun and tried to fire the ball to first but his throw rolled down the right-field line.
Niese allowed eight runs — six earned — and nine hits with five strikeouts and a walk.