Don’t tell Jose Carrera size matters. If he subscribed to that notion, the former Manhattan College shortstop wouldn’t be a professional baseball player today.

Told he was too short throughout his career, passed over for bigger athletes and ridiculed for his lack of height, the 5-foot-2 infielder never let his shortcomings hinder him.

“This game is not about size,” he said in a phone interview. “The biggest thing you can have in this game is your heart, and the mental side of it. If you’re tough and you believe in yourself, you can succeed. That’s what I think.”

That self belief was rewarded late last week, when Carrera signed a professional contract with the Yankees after going undrafted. Though disappointed not to get selected, Carrera didn’t give up on his dream. He went to Covington, Va., where he stayed in shape and worked out with his summer league coaches. The Yankees brought him in for a workout Thursday in Tampa, Fla., and he impressed them enough to earn a contract.

After the workout, Yankees player development analyst Dan Greenlee informed Carrera of the team’s desire to sign him. Carrera had to pinch himself. He remained calm as he listened to the team’s plans for him, but inside, he was almost shaking with joy.

“I was in shock. I felt like I was walking on water,” said Carrera, who will join the Rookie League Gulf Coast Yankees this week and now is the shortest player in the Yankees organization. “I had no words. Inside, I was crying. Every emotion you can think of.”

Greenlee said the Yankees already were familiar with Carrera as GCL pitching coach Elvys Quezada was a former assistant at Manhattan and raved about his character and leadership qualities. They suffered a few injuries, so they were looking for a middle infielder to bring in, and Carrera fit the need to a tee, particularly on the defensive side. His height wasn’t a concern.

“You don’t have to be the biggest guy on the field to make a major impact on the game,” Greenlee said. “He did some things [at the workout] that caught a lot of people’s attention. He makes a lot of things look easy that really aren’t easy.”

At the age of 12, a Little League coach suggested to Carrera he meet with doctors to take growth hormones, but his family, which had just immigrated to Miami from Cuba, couldn’t afford it.

“Do I regret not getting that injection? No, because everything happens for a reason,” said Carrera, who hit .299 in conference play with 11 stolen bases and 38 hits. “Maybe I would’ve grown to 5-foot-6, 5-foot-7, but so what? I don’t know if anything would’ve happened different. I’m 5-foot-2 and I’ve just been given an opportunity of a lifetime.”

Carrera’s height is only part of his story of perseverance. He has suffered three serious injuries. He fractured his right ankle his freshman year of high school, which cost him the entire season. But while he was out, he taught himself to hit left-handed and now is a switch hitter. As a sophomore in college, he broke his right hamate bone. This past season, he broke his left hamate bone. Carrera was given the option to redshirt, but he didn’t want to leave his teammates hanging. He sped back, returning from the injury to help the Jaspers reach the MAAC Tournament.

Carrera knows it is a long shot for him to reach his ultimate dream of playing in the major leagues. Few undrafted players get there. But it has happened before — just look at Mets infielder T.J. Rivera — and few even expected him to get to this point.

“I told myself I wasn’t going to stop playing until they said you’re done and they take that jersey off of me,” Carrera said. “I can’t control if I make it to the major leagues. I can’t control what’s going to happen in the future. What I can control is every day giving it my all.”