BALTIMORE — CC Sabathia turned back the clock a bit on Wednesday night, and the New York Yankees enjoyed watching his performance.

Sabathia threw seven innings in his best start of the season while Brian McCann drove in three runs as the Yankees snapped a six-game losing streak with a 7-0 victory over the Baltimore Orioles.

Sabathia (2-2) came into the game with a 5.06 ERA having allowed 12 runs in 21 innings but kept the Orioles (15-11) in check. He scattered six hits and got out of a couple of early jams while lowering his ERA to 3.81.

The left-hander struck out six and walked two for his first victory over Baltimore since 2013 and gave the Yankees (9-16) a badly-needed early-season victory.

“We had a great performance from CC,” Yankees manager Joe Girardi said. “He shut them down for seven innings, got some big double plays when he needed to and (gave us) just a brilliant performance.”

Sabathia kept the Orioles off-balance in different ways to slow their offense.

He changed speeds, worked both sides of the plate effectively, and kept a hard-hitting Baltimore lineup off its game.

“(I) got out of some trouble and was able to make some pitches,” Sabathia said. “The change-up was good; the two-seamer was good. It was just making pitches when I needed to. Hopefully, I just keep it rolling.”

Offense has been an issue during the first part of the season for New York but the Yankees went 4-for-12 with runners in scoring position.

They got all of their runs in two innings, three in the sixth and four more in the eighth. Overall, four of the runs came in with two outs.

McCann led the way by going 2-for-5 with his three RBIs. Both of his RBI hits sparked the New York rallies.

That’s what we’ve been lacking the first month of the season,” McCann said. “So, it was good to get some hits with some guys on base. We’ve been getting them on but we just haven’t been doing anything with them on.”

The Orioles didn’t fare quite as well in those situations.

Baltimore went just 1-for-10 with runners in scoring position, left eight on base and grounded into three double plays.

“We’ve had a few games where we’ve been able to score some runs early and capitalize on those opportunities,” Orioles first baseman Chris Davis said. “But for the most part, we’re not getting the job done when we have runners in scoring position.”

The Yankees gave Sabathia all the offense he needed in a three-run sixth inning against Baltimore starter Tyler Wilson (1-1). Carlos Beltran made it 1-0 on a sacrifice fly, and McCann added an RBI single two batters later.

Wilson then made a throwing error on Starlin Castro’s topper in front of the plate to bring in a third run. The right-hander had given up just one hit in the first five innings but the Yankees got their three runs on three hits in the sixth.

The Yankees had not scored a run since the second inning of Tuesday’s game.

New York then broke it open with a four-run eighth.

McCann added a two-run double off T.J. McFarland. Didi Gregorius lined an RBI single later in the inning, and Dylan Bundy hit Brett Gardner with the bases loaded to give the Yankees a 7-0 lead.

Jacoby Ellsbury also gave the Yankees a lift on offense in his 1,000th career game. He went 3-for-3 with two walks plus two steals and scored the game’s first run.

All of the production helped give Sabathia more than enough on a night where he was strong.

“He’s never going to give in,” Orioles manager Buck Showalter said. “Command was good, but he moved the ball around. He pitched well.”