Michael Pineda of the Yankees pitches in the first inning...

Michael Pineda of the Yankees pitches in the first inning against the Boston Red Sox at Yankee Stadium on Thursday, June 8, 2017. Credit: Jim McIsaac

Joe Girardi thinks Michael Pineda is learning. Maybe those years of inconsistency finally brought him here. Maybe that last start — a dud against Toronto — taught him a thing or two about pitching without his best stuff. Maybe all the gears are clicking into place in just the way the Yankees always hoped they would, and maybe he needed all those other years before this one to make it a reality.

There were times early in Thursday night’s 9-1 win over the Red Sox when he didn’t seem as sharp as he could be. But now it doesn’t seem to matter all that much.

“It’s growth in Michael,” Girardi said. “I think we’ve seen a lot of growth in Michael this year and we need to continue to see it.”

The first inning had all the hallmarks of a bad Pineda start. There were two infield singles and a walk, and it could have been worse if Gary Sanchez had not thrown out Mookie Betts attempting to steal.

But then? Nothing.

With two outs, he whiffed Hanley Ramirez with the slider that’s been working so well for him this year. He added something to that mental Rolodex that appears to be responsible for his growth. By the time he left after the seventh inning, he had allowed an unearned run and four hits, with two walks and eight strikeouts. The slider worked, the changeup worked, and Pineda worked just fine.

“A lot of times you just learn from your struggles,” Girardi said before the game.

Pineda, who has thrown two clunkers this year but is 7-1 with a 2.57 ERA in his other 10 starts, has emerged as a stable cog in the rotation. Girardi was asked what has improved, and he would have saved time by naming what hasn’t. The changeup is better, the fastball cuts more, and the slider?

“To me, the slider is key against this lineup, because they have a lot of righthanded hitters that you have to figure out how to get out,” he said.

All but two of Pineda’s strikeout pitches were on sliders.

Pineda (7-3, 3.39 ERA) has exceeded his win total for all of last year. He came into the game with a 2.09 walks-per-nine-innings ratio, 14th in baseball, and was 11th in strikeouts-to-walks ratio (4.47). He threw 110 pitches, 71 for strikes.

“I’m feeling really good because that’s why you work all day, work hard . . . to help your team, and right now, every five days, I try to help my team by winning the game,” he said. “Everything is going good, so I’m happy.’’

Pineda isn’t always going to have his stuff, of course.

“You’ve got to hope that he has it, and if he doesn’t, he’s going to have to find ways to get them out different ways that pitchers have to,” Girardi said. “A pitcher is probably going to have his ‘A’ stuff one-third of the time that he starts. He’s going to have ‘B’ stuff about a third of the time and then he’s going to have . . . some other stuff one-third of the time. That’s really what you do with that other third that really marks your season.”

And so far, this season has been pretty reliably good.

More Yankees headlines