PHILADELPHIA -- Still clinging to postseason hopes, the Washington Nationals will take every win they can get.
The Nationals remained 7 1/2 games behind Cincinnati for the second wild-card spot after overcoming a sloppy all-around effort that included three errors, four unearned runs and four wild pitches.
"That was an ugly game, one of the ugliest I've seen," manager Davey Johnson said. "That's not the way to win a pennant, I'll tell you that."
Gonzalez (9-6) gave up five runs -- one earned -- and five hits, striking out six in 5 2/3 innings. The lefty has two straight wins after going seven starts without one.
Ramos connected in the second and the Nationals never trailed. Brown hit a solo shot into the second deck off Luis Garcia in his first big-league at-bat of the season in the seventh to extend the lead to 8-5.
"The first time back there were a lot of emotions going on," Brown said. "I just tried to tell myself to get a good pitch to hit."
Phillies rookie Ethan Martin (2-4) allowed five runs and four hits in 4 2/3 innings. The righty hasn't reached five innings in his last three starts.
"It's frustrating," Martin said. "I'm trying to go as deep as I can and when I can't do that, it's frustrating."
Cody Asche was 3 for 4 with a homer and three RBIs for Philadelphia.
Rafael Soriano tossed a scoreless ninth for his 37th save in 43 chances.
A crowd of 28,826 was the smallest at Citizens Bank Park since April 3, 2008, when 25,831 turned out for a game, also against the Nationals, according to STATS LLC. That was the last time the Phillies drew under 30,000.
After leading the majors in attendance in 2011-12, the Phillies are fourth in the NL this season. But they're averaging 6,000 fewer people than last year.
"I was a little uncomfortable the whole game," Gonzalez said. "They were being patient and I wasn't pounding the strike zone. A win doesn't have to be pretty, but just a win."
Control issues cost Martin. He hit Jayson Werth on the left forearm with a 93 mph fastball leading off the second. After Adam LaRoche's one-out walk, Ramos drove one out to right-center for a 3-0 lead.
Martin walked three in the fifth, including LaRoche with two outs and the bases loaded to force in a run. Justin De Fratus came in and walked Ramos to force in Washington's fifth run.
Werth and Ian Desmond had RBI singles in the sixth for the Nationals to make it 7-2.
Asche's two-run single in the fourth got the Phillies within one. Kevin Frandsen led off with a single and Carlos Ruiz reached on third baseman Ryan Zimmerman's fielding error. They advanced on a wild pitch and scored on Asche's hit up the middle.
Shoddy defense hurt Gonzalez again in the sixth. With two outs, John Mayberry Jr. reached on shortstop Desmond's throwing error that scored Darin Ruf. Michael Martinez followed with an RBI single and went all the way to third on catcher Ramos' fielding error. Gonzalez exited and pinch-hitter Utley greeted Ryan Mattheus with an RBI single that cut it to 7-5.
"There's a few cracks in the dam and I'm trying to plug them, but I'm running out of fingers," Johnson said.
Nats LF Bryce Harper started running in after catching the second out in the eighth inning before realizing his mistake. He smiled and took some verbal abuse from the remaining fans. ... Denard Span extended his hitting streak to a career-high 16 games with a third-inning single. ... Phillies LHP Mauricio Robles made his major league debut, allowing two unearned runs in an inning. ... The Nationals selected SS Zach Walters and recalled Brown, LHP Xavier Cedeno, INF/OF Jeff Kobernus and OF Eury Perez from Triple-A Syracuse. ... Jordan Zimmermann (15-8) opposes Roy Halladay (3-4) when the teams finish the series Wednesday.
Follow Rob Maaddi on Twitter: https://twitter.com/AP-RobMaaddi
Reds actually want to see brooms come out in San Diego
The sweepee could become the sweeper Sunday at Petco Park in San Diego.
Indians, Braves facing unknowns in series finale
The big inning has played a prominent role in the first two games of the Atlanta Braves' interleague series against the host Cleveland Indians.
Barria leads struggling Angels vs. mashing Mariners
Jaime Barria will start on the mound for the Los Angeles Angels on Sunday afternoon against the Seattle Mariners, trying to achieve what has been a very difficult task for Angels starting pitchers this season.
Phillies look to escape Colorado with split -- and no more injuries
The Philadelphia Phillies came to Colorado in first place and fairly healthy. They're hoping to get out of Denver without any more damage and some momentum.
Jays, Sanchez seek sweep of A's
When the visiting Toronto Blue Jays go for a series sweep against the Oakland Athletics on Sunday afternoon, they won't get a chance to face injured former teammate Marco Estrada.
Rangers' Miller faces Astros seeking first win since 2017
The Texas Rangers will try to win a three-game series against the Houston Astros for the second time this season when they meet on Sunday in Arlington, Texas.