Capuano (11-8) shut down the Marlins until Jose Reyes lined a clean single to centre field with one out in the seventh.
Capuano allowed two hits in eight innings, striking out nine.
Ramirez, acquired in a trade with the Marlins on July 25, hit a sacrifice fly in the third. He added a two-run single in eighth, giving him 500 career RBIs.
Marlins starter Wade LeBlanc (1-2) pitched a season-high seven innings, allowing one run and six hits.
REDS 3, CUBS 0
CHICAGO (AP) — Johnny Cueto pitched three-hit ball for eight innings, Jay Bruce and Ryan Ludwick homered and Cincinnati beat the Cubs.
Cueto (15-6) moved into a tie with New York's R.A. Dickey for the NL lead in victories. He retired the Cubs in order in four of the first five innings.
Back in the lineup after sitting for two games because of a recent slump, Bruce hit a two-run shot into the right-field bleachers in the fifth off Brooks Raley (0-2). Ludwick connected with a drive to left in the sixth.
In his second big league start in place of injured right-hander Matt Garza, Raley retired the first 13 Reds. He allowed five hits and three runs over six innings.
BREWERS 5, ASTROS 3
HOUSTON (AP) — Yovani Gallardo handled Houston once again and Corey Hart homered as the Brewers broke an 11-game road skid.
Milwaukee won on the road for the first time since July 8 at Houston in its last game before the All-Star break.
Gallardo (11-8) won his 10th straight start against Houston. The right-hander allowed three runs and struck out eight in 7 2-3 innings.
Jordan Lyles (2-9) allowed eight hits and four runs — two earned — in seven innings for his fifth straight loss. He hasn't won since June 26.
PIRATES 11, PADRES 5
PITTSBURGH (AP) — Clint Barmes' first career grand slam keyed a nine-run fourth inning and Neil Walker went 5 for 5 as the Pirates rallied past San Diego.
Walker homered and doubled as the Pirates overcame an early 5-0 deficit and ended San Diego's six-game winning streak. The Padres had won 11 in a row at Pittsburgh dating to 2009.
Andrew McCutchen and Michael McKenry each drove in two runs during the big inning against Ross Ohlendrorf (4-3) and Cory Burns.
The Pirates sent 14 batters to the plate in the fourth inning. McKenry drew a bases-loaded walk from Ohlendorf just before Barmes' slam and then singled in the final run of the inning.
Erik Bedard (7-12) made it through five shaky innings for the win, allowing five runs — three earned — and five hits with four walks and six strikeouts.
PHILLIES 8, CARDINALS 7, 11 INNINGS
PHILADELPHIA (AP) — Juan Pierre beat out a run-scoring infield single in the 11th inning, lifting the Phillies to a win over the Cardinals.
Jimmy Rollins reached against Barret Browning (0-2) on a fielder's choice. He advanced to second base on a grounder and then stole third.
Pierre hit one deep into the hole that shortstop Rafael Furcal made a great stab at and fired to first. But Pierre just beat the throw and Rollins scored.
Philadelphia's Erik Kratz hit a three-run homer off Mitchell Boggs in the eighth that tied the game 7-all.
Jeremy Horst (2-0) tossed two scoreless innings for his first major league victory.
DIAMONDBACKS 7, NATIONALS 4
PHOENIX (AP) — Rookie Patrick Corbin allowed four hits through seven innings and the Diamondbacks snapped the Nationals' season-high winning streak at eight games.
Corbin (4-4) retired 16 in a row after Bryce Harper's infield single in the first. The 23-year-old right-hander gave up two runs, struck out seven and walked none.
Paul Goldschmidt drove in three runs with a double and single and scored twice for Arizona.
Ross Detwiler (6-5) allowed four earned and three hits in 4 2-3 innings.
METS 6, BRAVES 5
NEW YORK (AP) — Jonathon Niese pitched six-hit ball over eight innings, David Wright sparked the offence with a pair of doubles against Ben Sheets, and the New York Mets just hung on to beat Atlanta and salvage the finale of a three-game series.
Niese (9-6) matched the second-longest outing of his big league career, allowing one run, striking out six and walking two.
With the Mets ahead 6-1, the Braves loaded the bases with two outs in the ninth against rookie Josh Edgin.
Frank Francisco relieved and walked pinch-hitter Juan Francisco and Michael Bourn, forcing in a pair of runs, then gave up an opposite-field, two-run double to right to Martin Prado on an 0-2 pitch. Bourn was held at third as right fielder Mike Baxter made a clean pickup.
Jon Rauch then came in and retired Jason Heyward for his second save of the season.
Atlanta lost for the fourth time in 18 games while the Mets won for only the ninth time in 30, and for just the second time in 13 home games.
Sheets (4-2) had the poorest of his six outings this season, allowing five runs — four earned — and eight hits in six innings as his ERA rose from 1.41 to 2.13.
GIANTS 9, ROCKIES 6
SAN FRANCISCO (AP) — Hunter Pence hit a three-run homer during a five-run rally in the eighth inning that lifted the Giants over Colorado.
Buster Posey's sacrifice fly in the eighth tied it. Melky Cabrera, who had an RBI single in the comeback, drove in three runs.
Brandon Belt doubled twice and went 4 for 4 for the Giants.
Matt Belisle (3-4) took the loss after allowing the first three hitters he faced to reach bases.
Clay Hensley (4-3) pitched the eighth for the win.