Given the competitiveness of the NL Central, the Pittsburgh Pirates cannot afford to be mired in elongated losing streaks if they wish to keep pace.

But the club had dropped four straight heading into Wednesday’s contest versus the St. Louis Cardinals.

In Game 2 of 3 at Busch Stadium, Carmen Mlodzinski pitched five scoreless frames and had run support, and the bullpen preserved a lead for a 7-0 shutout victory.

Mlodzinski (4-3, 3.96 ERA) allowed four hits, walking one with a strikeout, picking up the win. After he departed, Yohan Ramirez, Evan Sisk, Justin Lawrence and Dennis Santana combined to close the door on St. Louis over the final four innings.

“To get out of the fifth and for (Mlodzinski) to get the win was big,” manager Don Kelly said on the SportsNet Pittsburgh postgame show. “I thought he did a good job throwing strikes. (The Cardinals) were fouling off a lot of pitches, and I thought he did a remarkable job getting through five. … Offensively, I thought we did a really good job at continuing to fire away.”

Konnor Griffin went 4 for 5 with three runs, and Endy Rodriguez, Jhostynxon Garcia and Jake Mangum had multi-hit evenings in a strong offensive performance by the bottom of the lineup.

In total, the Pirates collected 15 hits, going 6 for 15 with runners in scoring position.

Spencer Horwitz got the Pirates on the board in the second with a line-drive solo shot to right field off Cardinals starter Michael McGreevy.

The Pirates (25-24) then put two men on in the fourth as Griffin hit an infield single, advancing to second on a wild pitch, with Rodriguez walking.

That brought Garcia to the plate, and “The Password” swiftly recorded his first career big-league RBI on a single up the middle to plate Griffin.

Up 2-0 with two men on, a Mangum infield single loaded the bases with two outs, but Nick Gonzales grounded out to shortstop to end the frame.

In the fourth, Mlodzinski retired the Cardinals (28-20) in order for the first time on the night.

Mlodzinski’s pitch count was climbing in the fifth, especially after Nathan Church battled for 10 pitches before grounding out.

After Victor Scott ripped a two-out double into right-center field, manager Don Kelly had a decision to make and opted to leave Mlodzinski in to face JJ Wetherholt, who was 2 for 2.

But Mlodzinski got Wetherholt to ground out, ending the fifth and his outing at 95 pitches.

The Pirates chased McGreevy in the sixth, loading the bases for a chance to bust the game open.

Griffin, Rodriguez and Garcia singled, but a sacrifice fly by Gonzales generated the only run from the opportunity as the Pirates took a 3-0 lead.

With 12 outs to get, the Pirates bullpen took over in the bottom of the sixth, beginning with Ramirez.

It wasn’t long before Ramirez’s command issues created a jam, as with one out and Alec Burleson on first base (single), Jordan Walker was hit by a pitch and Nolan Gorman drew a walk.

Ramirez fell behind Masyn Winn, 3-0, with the bases loaded but battled back to strike him out for the inning’s second out.

Cesar Prieto then came to bat, and though Ramirez nearly plunked him with a breaking ball in the dirt, he escaped the inning when Prieto flew out sharply to the right-field warning track.

Sisk pitched a clean seventh for the Pirates, retiring St. Louis in order one night after surrendering a two-run homer to Gorman.

The eighth inning offered another opportunity for the Pirates to add insurance, and they capitalized, scoring four in a five-hit frame.

“It’s going to take everybody,” Griffin said. “We’ve got a really good team, a lot of depth and everybody’s working their tail off to do their job when that job comes. We’ve got faith in everybody. It’s going to be a fun rest of the year.”

Griffin got things started by reaching base on an infield single, his fourth hit of the day, and Rodriguez moved him to third with a single.

Mangum then scored Griffin with an RBI single, making it 4-0.

Gonzales followed with another hit, scoring Rodriguez for the 5-0 lead.

The Pirates proceeded to go up 7-0 on an RBI double by Bryan Reynolds that cleared the bases.

Lawrence pitched a scoreless bottom of the eighth, and Santana bounced back with a strong ninth.

“Everyone’s working really, really hard here,” Mangum said. “We’ve got a great clubhouse. We’ll build off of this win.”