WASHINGTON — The Washington Nationals comfortably lead the NL East, but after losing four straight games, they needed a win. Good thing it was Max Scherzer's turn in the rotation.

Scherzer allowed two hits over eight innings and Bryce Harper's two-run double helped the Nationals avoid a four-game home-and-home sweep with a 4-0 victory over the Baltimore Orioles on Thursday night.

Scherzer (14-7) struck out 10 and did not walk a batter. He retired 12 straight after Adam Jones's fourth-inning double and 21 of 22 before Mark Trumbo's leadoff single in the eighth.

"He stopped the skid," Harper said of Scherzer. "Unbelievable start by him tonight. You kind of imagine him going out there and doing that. When he does it, it's that much better."

Jayson Werth's solo home run off Ubaldo Jimenez (5-11) in the fourth inning staked Washington to a 1-0 lead. Daniel Murphy's RBI double in the eighth came before Harper's second hit helped the Nationals pull away.

The Nationals had dropped three straight to the Orioles, who won twice in Baltimore before the teams shifted to Washington.

Trumbo stole second base with two outs in the eighth, but J.J. Hardy flied out to deep centre field on Scherzer's 95th and final pitch. Mark Melancon allowed one hit in the ninth.

"We needed that so badly," Nationals manager Dusty Baker said. "Masterful. Masterful job by Max."

Scherzer won his second straight start, but was far more dominant than in each of his two previous outings when he allowed eight runs and struck out nine.

The right-hander retired the first nine batters and struck out two in each of the first three innings. Scherzer recorded his 47th game — 11th this season — with at least 10 strikeouts.

Jimenez allowed one run and five hits over six innings. He made his first start since July 28, but has lost three straight. The right-hander made three relief appearances before re-entering Baltimore's rotation because of Chris Tillman's injury.

"It felt really good to be able to be there for the team, especially right now (since) Tilly went down," Jimenez said. "Felt good that I was able to compete and give us a chance to be close."

Scherzer helped his own cause defensively in the fifth without seeing the ball. With his back facing home plate, he fielded a comebacker hit by Jonathan Schoop between his legs and threw him out at first base.

"I think we're going to be hearing a lot about that in the next couple of days so I don't want to give him too much credit," Harper joked.

Manny Machado's home run helped fuel Baltimore's offence in Wednesday's 10-8 triumph. On Thursday, he went hitless in four at-bats and 0 for 3 against Scherzer, falling to 1 of 18 all-time in the head-to-head matchup. Machado struck out with Jones on third and one out in the fourth.

"You can't just float anything in there. Everything has to be full throttle," Scherzer said of facing Baltimore. "With that lineup, if you make one mistake their going to hit it 450 feet."

After Jones was left stranded, Werth hammered the first pitch in the fourth over the wall in centre field.

Harper singled in the fourth and stole his 18th base, matching his career-high.

HELP ARRIVES

Washington acquired LHP Marc Rzepczynski (1-0, 3.00 ERA) and cash from Oakland on Thursday for minor league INF Max Schrock.

STRONG GRIP

2016 Olympic gold medallist wrestler Helen Maroulis, who hails from the Maryland suburbs, threw out the first pitch.

TRAINER'S ROOM

Orioles: Jones left in the ninth with hamstring cramps, but said he expects to play Friday. ... Manager Buck Showalter said Tillman (right shoulder bursitis) would throw on flat ground Monday or Tuesday.

Nationals: Stephen Strasburg, on the 15-day DL with right elbow soreness, played catch the last two days, Baker said, adding that the soreness is not in the same spot where Strasburg had Tommy John surgery in 2010. ... RHP Joe Ross, out since July3 with right shoulder inflammation, threw Thursday and "may not be too far of from going on a rehab assignment," Baker said.

UP NEXT

Orioles: Yovani Gallardo (4-5, 5.08) and Yankees RHP Luis Cessa (3-0, 4.01 ERA) open the three-game series in New York.

Nationals: LHP Gio Gonzalez (8-9, 4.30) faces Rockies RHP Jeff Hoffman (0-1, 13.50) in the first of three games against Colorado.