MINNEAPOLIS — CC Sabathia keeps burnishing those All-Star credentials.

Though a bit of an asterisk must be added because of the competition, the lefthander again shut down the opposition in a 4-1 Yankees victory over the struggling Twins Thursday night in front of 23,751 at Target Field.

“His numbers are as good as anyone’s,” Joe Girardi said of Sabathia before the game.

They only improved after he allowed one run and six hits over six innings, which lowered his ERA to 2.20 from 2.28. Sabathia, 3-2 with a 0.71 ERA in his previous six starts, walked three and struck out seven. He threw a season-high 116 pitches as the Yankees (32-34) stopped a four-game losing streak.

“My command was off, all over the place,” Sabathia said, most upset with his two-seamer. “They had a lot of runners on, threw a lot of pitches, but I was able to make some pitches. Mac [Brian McCann] called a great game and we got some pitches when we needed it.”

Even so, there’s no one in the rotation Girardi would rather see on the mound.

advertisement | advertise on newsday

“He’s a guy that I’ve always said finds a way,” Girardi said. “He competes. He wants the ball.”

Still, for much of the night it looked as if the 35-year-old, who stranded nine over the first five innings, might absorb a hard-to-fathom loss to the Twins (20-46).

It took a Didi Gregorius three-run homer in the seventh inning off lefty reliever Fernando Abad to snap a 1-1 tie.

“It was good to get a ‘W’ for him,” Gregorius said of Sabathia (5-4).

Until then, it had mostly been another night of frustration for the Yankees. Righthander Kyle Gibson came in 0-4 with a 6.49 ERA but took a 1-0 lead into the sixth. The Yankees tied it on a Jacoby Ellsbury single, and it was 1-1 going into the seventh.

Yankees videos

There, the slow-footed Alex Rodriguez reached on a single to third and McCann walked. After Starlin Castro’s sacrifice bunt, Twins manager Paul Molitor brought on the lefty Abad. Gregorius, hitting a team-best .357 against lefties, torpedoed the first pitch to deep right for his sixth homer, making it 4-1.

“A pitch in the zone that I can drive,” Gregorius said of what he was looking for. “He threw me a fastball right down the middle.”

Dellin Betances pitched a scoreless seventh, Andrew Miller pitched a scoreless eighth and Aroldis Chapman did the same in the ninth to record his 12th save in 13 chances.

The vast majority of the night was characterized by the 13th-lowest scoring team in the AL (the Yankees) and the 14th lowest-scoring team matching futility at the plate.

After Gibson, who had an 18.00 first-inning ERA, set down the Yankees in order in a 14-pitch top of the first, the Twins stranded two in the bottom half, then left the bases loaded in the second.

advertisement | advertise on newsday

Sabathia, at 46 pitches through two, pitched a clean third inning before again finding trouble in the fourth, an inning in which Nunez gave the Twins a 1-0 lead with a two-out single to right.

After Sabathia stranded two more Twins in the fifth, Gregorius led off the sixth with a single. Chase Headley doubled and Ike Davis walked, loading the bases for Ellsbury, who swatted an RBI single to center to tie it at 1. That would be all the Yankees would get. Gardner popped to second and Carlos Beltran grounded into a 6-4-3 double play. Sabathia talked Girardi into letting him go out for the sixth — “I begged him to go back out,” he said — and the pitcher set down the Twins 1-2-3.

“Just keep it going,” Sabathia said of the run he’s on. “Keep building. Tonight the command wasn’t where I wanted it to be. Hopefully it is in five days when I’m [back] out there.”