WASHINGTON -- Backed by a potent offense, Josh Fogg rebounded from his worst start of the season with a sharp effort.
Todd Helton, Ryan Spilborghs, Holliday and Garrett Atkins finished with two hits apiece for the Rockies (32-32), who won for the fifth time in seven games and moved back to .500 for the first time since June 2.
Fogg (4-4) had four strikeouts and allowed six hits, including four doubles. In his last start, on June 7 against Pittsburgh, Fogg allowed a season-high eight runs in 4 1/3 innings.
"The offense did a good job for me getting those runs, and I was able to take advantage," Fogg said. "I was able to locate my cutter in and out. It's just a matter of getting ahead (in the count) and staying ahead."
Washington rookie Mike O'Connor had the worst outing of his young career, surrendering six runs and six hits in 5 2/3 innings. O'Connor (3-4) allowed more than three runs for the first time in 10 starts. He left after allowing five runs in the sixth inning.
"It's definitely frustrating, it's probably the most frustrating outing I've had," O'Connor said. "I was cruising along, pitching really well, then all of a sudden I let the game get away."
The score was tied at 1 in the sixth inning when Holliday's go-ahead double drove in Spilborghs and Helton, who had hit consecutive one-out singles. After an intentional walk to Atkins and a groundout by Yorvit Torrealba, Barmes doubled down the third-base line, knocking O'Connor out of the game. Barmes scored when Choo Freeman hit reliever Saul Rivera's first pitch into left field for an RBI single.
"Any time you become a little more familiar with the guy, it becomes a little more in our favor as hitters," Holliday said. "You see a guy more than a couple of at-bats, you know his pattern and how he is trying to get you out."
The Rockies added three runs in the seventh off reliever Mike Stanton. Helton and Torrealba had RBI singles and Barmes hit a sacrifice fly.
Freeman drove in the game's first run with a groundout that scored Atkins, who doubled to leadoff the fifth.
The Nationals had 10 hits but stranded 12 runners and lost for the third time in four games.
Jose Vidro tied it with an RBI single in the bottom of the fifth for Washington and Alfonso Soriano drove in a run with a double in the eighth.
Vidro's single broke an 0-for-13 slump. He left the game in the seventh inning with a bruise on the right side of his chest. An inning earlier, Vidro went into the outfield to make a spectacular diving catch of a looping liner by Rockies 2B Jamey Carroll. He is listed day-to-day. ... Nationals OF Daryle Ward was sent home before the game with the flu. He is listed as day-to-day. ... Washington 1B Nick Johnson tied his season high with three walks. He walked three times on April 15 against Florida. ... ... Carroll has at least one hit in six of his last seven games. ... The Nationals issued two intentional walks, increasing their season total to 36, the most in the majors. ... The Nationals had five doubles.