NYCFC's Jonathan Lewis #17 celebrates his game-winning goal during stoppage...

NYCFC's Jonathan Lewis #17 celebrates his game-winning goal during stoppage time against the New England Revolution at Yankee Stadium on Aug. 20, 2017. Credit: Daniel De Mato

It was far from the stellar performance you would expect from a team with the second-best record in Major League Soccer, but even a mediocre one was good enough.

New York City FC found a way to get past the stubborn New England Revolution on Sunday night, striking twice in the final 13 minutes to overcome a one-goal deficit and earn a 2-1 win before 22,415 at Yankee Stadium.

David Villa tied it and rookie Jonathan Lewis, a second-half sub, struck for the dramatic winner in the fourth minute of stoppage time against the 10th-place Revs (8-11-5, 29 points).

“Winning games when you don’t play well, that is a good sign for the team,” NYCFC coach Patrick Vieira said.

For the second straight home game, NYCFC rallied from a one-goal deficit to win.

“Great again,” Villa said. “I don’t like to [have to] come back, but we came back. It shows how strong we are.”

City (14-7-4, 46 points) remained within striking distance of leader Toronto FC (14-3-8, 50) in the Eastern Conference and also extended its lead over the third-place Chicago Fire (12-8-5, 41) to five points.

“I think Toronto already is the champions,” Vieira said. “I think the other teams will fight for the second spot. As you saw last night, they are really strong. I don’t think anyone will catch them.”

Toronto romped over host Chicago, 3-1, on Saturday.

The Revs made life difficult for NYCFC, using a five-man backline while clogging passing lanes and giving the hosts very little room to shoot.

“We’re talented enough that we’re going to find the break- through,” Lewis said.

It didn’t look as if City would break through, especially after the Revs took a 57th-minute lead on Teal Bunbury’s goal after goalkeeper Sean Johnson failed to corral Andrew Farrell’s shot that took a hard bounce off his body.

Villa tied it in the 77th minute from seven yards before starting the winning sequence with a pass to defender Ben Sweat, who slipped the ball to Lewis on the right side of the box. Lewis beat keeper Cody Cropper from seven yards for his second pro goal in as many games.

“We just have to play small one-twos between their backline to break them down,” Lewis said. “We have to find little gaps. Even David’s goal, that was a little gap. We squeezed through. For my goal, a little gap opened up.”

More soccer news