Jayson Werth is congratulated by teammates after hitting his first of two home runs in the Nationals’ six-homer, 19-hit barrage against the Orioles. (Greg Fiume/GETTY IMAGES)

The Washington Nationals scored Friday night for the first time since Monday. Once they started, they could hardly be stopped in a 17-5 win over the Baltimore Orioles to open interleague play.

It had been a rough week for the Nationals, what with being shut out in consecutive games, rained out once and having General Manager Mike Rizzo find himself in the middle of a league investigation over an incident with the umpires after a loss to the New York Mets on Thursday.

But in recording their first victory by more than four runs this season, the Nationals did their best to put all that previous malaise behind them before an announced crowd of 24,442. They scored the most runs and hit the most home runs (six) in a game since the team moved to Washington, and they set a season high with 19 hits.

After doing his part to help raise the team’s batting average six points to .229, second baseman Danny Espinosa said the players in the visiting clubhouse at Oriole Park at Camden Yards knew they had such an offensive performance in them. It was just a matter of timing.

“We know we can hit,” said Espinosa, one of two Nationals batters who came within a double of hitting for the cycle on Friday. “But for everybody to get going like that, it was unbelievable. I know it boosted everybody’s confidence in here and shows that we can hit and that we’re going to go out there and do it.”

After spending the previous two days unable to bring a runner across home plate, Washington chased Baltimore’s starting pitcher, Jake Arrieta, after 32 / 3 innings of work.

Espinosa proved particularly effective against Arrieta. His three-run home run in the second put Washington on the scoreboard for the first time in 20 innings. His RBI triple in the fourth put the Nationals back on top after their lead had evaporated a frame earlier.

“My timing was better,” said Espinosa, who entered the night batting .194. “That was just the whole thing. Previously, I had been late to everything and making my swing long, so it was just all timing. I’ve been working real hard with [hitting coach Rick] Eckstein, and finally I was getting my foot down and my swing was getting shorter. It felt good up there.”

And not just for Espinosa, who finished with five RBI. Catcher Wilson Ramos scored after five of his six plate appearances Friday. He, too, came a double shy of hitting for the cycle.

Right fielder Jayson Werth spent his 32nd birthday smashing two home runs and tallying four RBI of his own, snapping a seven-game streak in which he had not brought home a base runner.

“Jayson has been playing really good,” Nationals Manager Jim Riggleman said. “He just has not gotten totally on track offensively. But he had a real big night.”

After being shut out in its two-game series in New York, Washington reversed course and witnessed its hitters doing everything they could early on to bail out its starting pitcher. Jason Marquis lasted just four innings, allowing five runs, eight hits and three walks.

Riggleman said Marquis was “about as upset as I’ve ever seen a ballplayer” when he was removed from the game before the bottom of the fifth, but Marquis dismissed his dugout tantrum as a heat-of-the-moment flare-up.

On Friday — in a strange turn of events for a Nationals lineup that featured three hitters batting below .200 at first pitch — the effectiveness of Washington’s starting pitcher, or lack thereof, mattered little.

Henry Rodriguez, who relieved Marquis, pitched three scoreless innings — during which the Nationals’ lead ballooned from 6-5 to 14-5 — to earn the victory, the second of his major league career and first with the Nationals.

Roger Bernadina hit his first home run of the season — a two-run shot that bounced over the wall off the center fielder’s glove and nearly doubled his season RBI total — in the fifth.

Three batters after Bernadina’s blast, Werth smashed his seventh home run of the season — a two-run shot to give the Nationals a seven-run lead — into the stands in right-center. For good measure, Werth added another home run in the seventh.

“For whatever reason, we haven’t been swinging the bats, which is unfortunate because we’ve got a good lineup and a good group,” Werth said. “It’s hard to say exactly what it was, but hopefully we can build off it.”