Adam LaRoche added three hits, an RBI and he scored twice.
Alvarez, while effective, also was a bit unlucky, especially in a two-run sixth that gave the Nationals some breathing room.
In 5 2/3 innings, Alvarez allowed three runs (one earned) and struck out four.
The Marlins opened their six-game road trip with a loss, and have dropped two straight for the first time in the young season. At 5-3, they also fell a half-game behind Washington (5-2) in the National League East.
In the sixth inning, a costly two-out error led to the Nationals breaking open a one-run game.
"We made a mistake in there, and gave them an extra out and they capitalized on it," Marlins manager Mike Redmond said. "We talked about having to eliminate our mistakes. When you play teams like this, you give them an extra opportunity, they usually capitalize on it. They did tonight.
"But at the end of the day, we didn't score any runs. It's tough to win when you get shut out."
Getting shut out at Nationals Park is becoming an all-too-familiar occurrence for the Marlins.
Last year, the Marlins were blanked four times and were 1-9 at Nationals Park. They've been shut out five of their last 11 games in the ballpark.
"For whatever reason, these guys have some good pitchers, but we've got to find some ways to score some runs," Redmond said. "We had a couple of opportunities. We just didn't get a big hit. But I've said that a lot over the last couple of years."
Alvarez limited the Nationals to one run through five innings, but they broke through for two unearned runs in the sixth to make it 3-0.
Bryce Harper singled with one out, and LaRoche's two-out single put runners on the corners. A turning point came with Ian Desmond at the plate. Alvarez bounced a pitch that skipped away from catcher Jarrod Saltalamacchia.
"With Alvarez, he's not a guy you can really steal bases on, but he does throw a lot of balls in the dirt, so it's something we talked about before the game," Nationals manager Matt Williams said. "If we get an opportunity to do that, be ready for it and be alive for it. It's part of the game plan going in."
Seeing the opening, LaRoche took off for second, and Harper was about halfway down the line at third. Saltalamacchia threw to second, and the Marlins were nearly out of the inning. But Jeff Baker was tagged with an error when he was unable to hold onto the ball, allowing LaRoche to be safe and Harper to score.
"I caught it the end of my glove. I put it down, LaRoche came in, hit it. It kind of went away. That was that," Baker said. "We didn't score. Obviously, I've got to make that play. At the same time, we've got to score some more runs."
Desmond walked, and Anthony Rendon's two-out single gave the Nationals a three-run lead, ending Alvarez's night. Both of the runs were unearned.
The Nationals were able to strike quickly off Alvarez, getting on the board after logging a pair of two-out hits.
Jayson Werth laced a double to left-center and scored on LaRoche's single to left.
After that, Alvarez settled and was cruising until the sixth.
"I made adjustments from my first start," Alvarez said. "I felt good today. In the sixth inning, there were a couple of little mistakes there, but I felt good. I was able to make adjustments from the first start."
The early lead set the tone for Gonzalez, who limited the Marlins to three hits over six innings.
As they've done all season, the Marlins made their opposing starter work. Gonzalez was at 59 pitches through three innings, and he was at 101 when he exited after six innings.
But the Marlins advanced a runner as far as second base just once, in the second.
In the third, Adeiny Hechavarria led off with a single to right field. But attempting to steal, he was caught by Gonzalez. Instead of a pickoff, it was ruled a caught stealing.
From that point, Giancarlo Stanton's two-out single was the last hit and baserunner Gonzalez allowed. But Stanton's streak of knocking in a run in seven straight games to open the season ended.
"[Gonzalez] always has good stuff," Baker said. "He was effectively wild tonight. He made the pitches when he had to. With his stuff, even when he's not in the zone, it still can be a battle. That basically is the way it is every time you face him."