The score was tied at 1 when Washington took the lead in the sixth inning against right-hander Guillermo Moscoso. Ian Desmond led off with a single to left and LaRoche followed by hitting a two-run homer over the right-field fence.
"It was a fastball right there," LaRoche said. "He comes with a first-pitch curveball. We have a guy on first. I'm assuming he is going after me. He left one right over the plate and I hit it pretty good."
San Francisco cut the deficit in the top of the seventh inning. With Ryan Mattheus on the mound, Joaquin Arias scored on a single by Hunter Pence. The run was charged to Fernando Abad. But Tyler Clippard and Rafael Soriano blanked San Francisco the rest of the way, while Soriano saved his 30th game of the season. It marked the third time Soriano recorded 30 or more saves in a season.
"I'm going to take every opportunity and see how the team does right now," Soriano said. "Right now, I don't think about [the saves]. I think about the win and see what happens later."
Left-hander Gio Gonzalez started the game and found himself in a heated argument with right fielder Jayson Werth in the middle of the first inning.
Werth was upset that Gonzalez didn't get to first base in time for a potential inning-ending double play after Buster Posey hit a grounder to LaRoche at first base.
"I kind of read it wrong. I didn't think LaRoche was going to make that play," Gonzalez said. "I thought [second baseman] Anthony [Rendon] was. I didn't cover the bag. It was the way I fell off the mound. After that, I had to minimize damage."
Gonzalez also was dealing with back spasms, and that's why he had problems covering first base. The back started to get better as the game went along.
"I'll be ready for my next start," he said.
The TV cameras showed Werth and Gonzalez arguing in the dugout after the top of the first inning ended, while pitching coach Steve McCatty and hitting coach Rick Schu had to separate them.
"Just a little camaraderie going on," Nationals manager Davey Johnson joked. "Jayson sometimes can get a little vocal. He thought Gio wasn't covering first. ... The spirits are high. No big deal."
Gonzalez pitched four shutout innings and allowed two hits. He left the game after a one-hour, 17-minute rain delay. Werth went 1-for-4 and scored a run on a sacrifice fly by Kurt Suzuki in the eighth inning.
LaRoche said the incident between Gonzalez and Werth will be forgotten by Wednesday.
"You have a year where we've underachieved and struggled," LaRoche said. "We are around each other all day long. On occasions, tempers are going to flare. Guys are competitive, it's going to happen. They will both be over it tomorrow, so will we."