Max Scherzer and the Washington Nationals' bullpen got plenty of big outs. Ryan Zimmerman took care of the offense.

Zimmerman homered twice, then doubled home the tiebreaking run in the eighth inning as the Nationals ended their nine-game losing streak at St. Louis, beating the Cardinals 4-3 Wednesday night.

"We played well the first two games of the series but they're a tough team to close out," Zimmerman said. "They're not 40 games over .500 for no reason."

Zimmerman reached 200 career home runs with his second shot. Jayson Werth also homered for the Nationals.

"It's hard to think about things like that when you're still playing," Zimmerman said. "But it's not too bad for a guy who's supposed to be a defensive specialist."

Scherzer struck out 11, gave up 11 hits and left with a 3-2 lead after the sixth. Walking none was a big help.

"They grinded out a bunch of hits against me but I was always able to find a way to make a big pitch in a big situation, keep them at bay," Scherzer said. "I was constantly on the attack."

Johnathon Papelbon earned his 23rd save in 23 chances, escaping a first-and-third, one-out jam in the ninth. Rafael Martin (1-0) got one out for his first career victory.

Johnathan Broxton (1-4) took the loss. The Cardinals had a base open with one out in the eighth but elected to pitch to Zimmerman and see if he would expand his zone with two strikes.

"Zimmerman has issues this year with the right-handers, hitting under .200," manager Mike Matheny said. "It didn't work this time."

Brandon Moss hit a 454-foot homer for St. Louis, which leads the Pirates by six games with 29 to play in the NL Central.

Kolten Wong had three hits for the Cardinals in their second loss in 11 games.

"Today, we just couldn't pull it off," manager Mike Matheny said.

Moss ended Wednesday night's game in the ninth with a three-run homer. He led the second against Scherzer with the longest home run by a left-hander at 10-year-old Busch Stadium and the fifth-longest overall.

The Nationals answered with homers by Werth in the third and drives by Zimmerman in the fourth and sixth.

Zimmerman has 16 homers in an injury-abbreviated season, four in this series.

The Cardinals opted to give 15-game winner Michael Wacha some rest and fill-in starter Tyler Lyons allowed three runs in six innings. Lyons struck out six the first time through the order.