NYC FC's Thomas McNamara scores winning goal in game where...

NYC FC's Thomas McNamara scores winning goal in game where NYC FC defeated the San Jose Earthquakes 2-1 at Yankee Stadium in Bronx, New York on April 1, 2017. Credit: Patrick E. McCarthy

For Tommy McNamara, it was an opportunity to seize the moment to remind head coach Patrick Vieira that he deserved more playing time.

After starting all but four of the 34 regular-season games last season, the West Nyack, N.J. native logged only 43 minutes entering Saturday’s game against the San Jose Earthquakes.

He made the best of his chance, connecting in the 67th minute, four minutes after replacing Andrea Pirlo to snap a deadlock and lift New York City FC to a 2-1 victory before 20,066 at Yankee Stadium.

The win extended City’s (2-1-1, 7 points) regular-season home unbeaten streak to 11 games (9-0-2).

“Whether you’re starting for 10 weeks in a row or you’re just coming off the bench and you haven’t played this season, it’s always an opportunity,” McNamara said. “It’s always to make an impression within the coaching staff. But the most important thing to do whatever the team needs at this moment.”

Which was a goal.

Vieira thought he faced so many questions about McNamara’s heroics that he joked: “I am going to have to start him next week.”

The goal exemplified what Vieira has been preaching — a build-up with many touches by several players.

As center back Alexander Callens reached the box, he passed to David Villa, who flicked it to the left to overlapping fullback Ronald Matarrita. The Costa Rican sent a left-wing feed to McNamara, who fired a 15-yard shot off the right post past goalkeeper David Bingham.

“I remember thinking to myself, just get myself into the box, get myself free and into a good area,” McNamara said. “When the ball broke through with Mata, I was just hoping he would cut it back to me. I made sure I would keep it on frame because the goalie was a little bit out of the occasion at that point.”

The Quakes (2-2-0, 6) drew first blood in the sixth minute when goalkeeper Sean Johnson played a poor back pass from Pirlo to the right side. The ball went off Callens’ leg to Marco Urena, who had no difficulty scoring.

“That will happen,” Vieira said. “I don’t think it will be the last one. That is the way we want to play the game. When you want to play the game that way, there is a risk to take and I’m prepared to take that because I strongly believe that we are going to create more than we are going to concede.”

That strategy worked for the equalizer in the 10th minute. Matarrita fed Villa, who who flicked the ball to Jack Harrison. Bingham blocked his shot, but the ball’s momentum carried it off the right post and into the net.

More soccer news