T.J. Rivera spent his season hitting, as he’s always done, yet he kept getting passed over. When a need for an infielder would arise, the Mets would find another option.

In a season of great expectations, the Mets were hesitant to entrust playing time to untested players. But when openings came up, they went to Matt Reynolds and Ty Kelly. And when David Wright went down, the Mets signed Kelly Johnson and Jose Reyes to help fill the void.

All the while, Rivera kept hitting at Triple-A Las Vegas, where he won the Pacific Coast League batting title. But despite his frustration, Rivera endured.

When the Mets took their positions in Wednesday night’s National League wild-card game, Rivera jogged to second base, the culmination of a journey that began as an undrafted free agent in search of a chance.

“I’m not going to say it was easy, I’m not going to say it was ‘OK, oh yeah, that’s fine, I’m not getting my chance, I’m cool with it,”’ Rivera said this week. “It wasn’t like that. It was like ‘I’m frustrated. I want to be out there, I want to be playing,’ That was the emotion most humans are going to have. But I wasn’t going to let it affect me.”

Rivera, 27, refused to go away. In 2011, he landed with the Mets’ rookie ball team simply because they had a vacancy. He hit his way up the ranks, all the while using his bat to mask the questions brought about by his glove.

advertisement | advertise on newsday

“Here’s a guy that has done nothing but overachieved everywhere,” manager Terry Collins said. “He’s always dealt with adversity because of no real position. He’s played third. He’s played short. He’s played second. He’s got some outfield time. But he’s always hit. Every place he’s been, they all say this guy can help you.”

Rivera has done just that for the Mets, solidifying his hold on second base when Wilmer Flores, who was replacing the injured Neil Walker, went down with a wrist injury. He arrived as a September call-up, his fourth stint with the big-league team this season.

In his last 18 games, Rivera is hitting .369 with three homers and 13 RBIs. Questions about his defense still dog him. The Bronx native lacks the typical range of a second baseman, though the Mets have been more than willing to make the tradeoff.

“It’s like Daniel Murphy,” said one rival scout. “When he hits the way he’s hitting, it’s fine.”

Hitting never has been the issue. And according to Collins, it’s why Mets special assistant to the GM J.P. Ricciardi remained one of Rivera’s steadfast backers in the organization.

Mets videos

Collins said Rivera’s simple swing, free from the clutter of complicated mechanics, made him an intriguing possibility if given a chance.

In the winter, the Mets neglected to protect Rivera in the Rule 5 draft, allowing any team in the big leagues access to his rights in exchange for keeping him on the big-league roster for the rest of the season. He was not chosen.

Then, the summer began, Rivera caught fire, and yet he found himself the odd man out.

“If it happened and I got frustrated, it would be a couple of hours and that was it,” Rivera said of getting passed over. “Maybe the next day you would think about it, but I tried to throw those thoughts out as quick as possible. Some times are harder than others, but you just try to throw that out. It wasn’t going to help me to keep thinking about it. It would only affect me negatively.”

After six minor league seasons, Rivera could have given in. At 27, he wasn’t getting any younger, his chances of breaking through growing slimmer by the year. But he couldn’t shake the thought of belonging in the big leagues, resolving to keep “pushing until something happened.”

advertisement | advertise on newsday

Then, something happened.

“That’s why you salute the guy because he never stopped playing, never stopped challenging himself to be successful,” Collins said. “He had great confidence in what he could do and just kept doing it. A lot of guys would have threw their hands up and said I need to go someplace else.”

On Wednesday, Rivera lived out a childhood dream. From his parents’ house in the Bronx, he made his way to Citi Field for a do-or-die game against the Giants.

With the season on the line, the Mets turned to nine players in the starting lineup, tasking them with saving it. Rivera, undrafted, passed over, left unprotected in the Rule 5 draft, was one of them.

“People like the story because it gives people hope, maybe, that sense of hope like ‘I can do something I’ve always dreamed of as well, you know what I mean?’” Rivera said. “I guess maybe being undrafted and not being a top prospect and things of that nature, people see where I’m at. I can do what I really dreamed of doing. That was my goal. I hope I can inspire people to go after their dreams and their goals, that would be awesome.”