PHILADELPHIA — Once he figured out his new delivery, Jake Thompson looked sharp.

Thompson pitched well after a shaky start, but Jayson Werth hit a solo homer and the Washington Nationals beat the Philadelphia Phillies 4-0 on Monday night.

Thompson (1-4) allowed two runs and seven hits in seven innings. It was the longest and best of his five career starts and came after he adjusted the way he throws.

“It was huge,” Thompson said of the adjustment. “Just on the physical side of things, I’m in a better position to make pitches. It actually wasn’t too difficult. It’s really simple, just small moving parts instead of a bunch of stuff moving at the same time. I got off a mound twice this week in the bullpen. I feel like that helped a lot, just getting those reps.”

After giving up two runs in the first, Thompson was excellent. His last pitch was a nasty curve that froze Trea Turner for strike three.

“What a job he did after the first inning,” manager Pete Mackanin said. “Gradually as the game went along he got better and better, and then in that seventh inning he really battled hard to get out of that. That was huge. Great to see. I’m real pleased with that, and that’s just what he needed. He needed a real positive outing.”

Tanner Roark (14-7) allowed four singles and struck out five. Marc Rzepczynski tossed a perfect eighth and Mark Melancon finished off the four-hitter for the Nationals.

Werth lined a solo shot to left in the first against his former team. A member of Philadelphia’s 2008 World Series championship team, Werth was greeted by boos, as usual.

Bryce Harper raced home from first on Anthony Rendon’s single to left-center to make it 2-0 in the first. Clint Robinson and Turner had RBI singles off Frank Herrmann in the ninth.

Roark didn’t need much support. The righty stifled the Phillies again. He’s 3-0 with a 0.64 ERA against them this season.

“He’s a good pitcher. He mixes it up. He locates. He does all the things you try to tell our pitchers to do,” Mackanin said. “He’s poised. He pitches to get you out. He just battles.”

The NL East-leading Nationals snapped a two-game losing streak.

DIVISION DOMINANCE

Washington is 36-16 against the rest of the NL East. It’s the best division record in the majors.

ROSTER MOVES

OF Michael A. Taylor was recalled from Triple-A Syracuse by the Nationals. RHP Lucas Giolito was optioned down.

ODUBEL ON THE MOVE

Phillies All-Star CF Odubel Herrera will likely play a corner outfield spot in winter ball. Mackanin has been impressed with Aaron Altherr in center and prospect Roman Quinn also plays there.

TRAINER’S ROOM

Nationals: RHP Stephen Strasburg threw a bullpen session one week after he was placed on the DL with elbow soreness. Strasburg is expected to return to the rotation when he’s eligible.

UP NEXT

RHP Max Scherzer (14-7) starts for the Nationals against RHP Jerad Eickhoff (9-12) on Tuesday night. Scherzer is 6-1 against the Phillies in nine career starts. Eickhoff had 10 strikeouts in his only career start vs. Washington on Sept. 25, 2015.