Adam Wainwright allowed two hits in eight masterful innings and Paul Goldschmidt homered to lead the St. Louis Cardinals over the Pittsburgh Pirates 3-0 on Sunday.

The Cardinals snapped a two-game skid and kept the Pirates from earning their first series sweep of the season. They remain the only team in the majors without one.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Wainwright (12-7) threw 106 pitches and retired his final 11 hitters. He hasn't permitted a run in his past 19 innings against the Pirates and has won his last seven decisions against them.

The 39-year-old right-hander struck out nine and did not walk a batter in improving to 20-7 lifetime against Pittsburgh.

"I just match up pretty well against them," Wainwright said. "But, they beat me around pretty good earlier in my career. This is just payback."

Wainwright has given up just six hits during his 19-inning scoreless run against Pittsburgh, with 19 strikeouts and no walks.

"Textbook. That's how you teach kids to pitch," Goldschmidt said. "He lives it out daily. And he's been doing it for such a long time. Eight innings was huge. He really picked us up today."

Wainwright has gone at least seven innings in 14 of 25 starts this season. He used his breaking ball to stymie the Pirates for the second time in 11 days, including a two-hitter in a 4-0 win at Pittsburgh on Aug. 11.

His last loss to the Pirates came on April 3, 2016.

"We need to come up with a better game plan," Pittsburgh manager Derek Shelton said. "At some point we have to figure out a way to combat that because he's gotten us three times now."

Goldschmidt hit his 19th homer in the fifth to make it 2-0. He had two hits and extended his hitting streak to 11 games.

"Been swinging it pretty well," Goldschmidt said. "Got a little lucky a few times. It probably looks better than it really is."

Alex Reyes got his 28th save in 30 chances. Right fielder Lars Nootbaar hauled in a long drive by Colin Moran with two on to end it.

Yadier Molina brought in Goldschmidt with a run-scoring single in the first off Steven Brault (0-2), who gave up one run and five hits over four innings. Goldschmidt ripped a one-out single off third base to start the outburst.

Harrison Bader added a run-scoring single in the eighth.

Pittsburgh won five of its previous six games in St. Louis.

CLICK HERE TO GET THE FOX NEWS APP

ROLE REVERSAL

St. Louis has won 10 of its last 11 in Pittsburgh. The Pirates went 5-4 in St. Louis this season and 3-2 last year.

TRAINER’S ROOM

Pirates: RHP Sam Howard worked two scoreless innings for Triple-A Indianapolis on Friday night. He is on the 10-day injured list with a right oblique strain.

UP NEXT

Pirates: RHP Will Crowe (3-7) will face Arizona in the first of a three-game set Monday in Pittsburgh. The Diamondbacks had yet to announce a starter. Crowe ranks fourth among NL rookies with 79 strikeouts.

Cardinals: RHP Jack Flaherty (9-1, 2.68 ERA) will face Detroit RHP Casey Mize (6-6, 3.69) in the opener of a two-game series Tuesday in St. Louis. Flaherty has allowed two runs in 12 innings over two starts since returning Aug. 13 from a long stint on the injured list due to a left oblique strain.