From the opening kickoff to the final whistle Sunday night, David Villa was virtually unstoppable.

In other words, it was a typical game for the legendary 35-year-old Spanish striker.

Villa not only earned his first MLS hat trick but transformed the match within a three-minute span, rallying New York City FC from a one-goal deficit to a 3-2 triumph over the Red Bulls in the latest edition of the Hudson River Derby before 33,679 at Yankee Stadium.

Villa’s stellar performance overcame an impressive match by his Red Bulls counterpart, Bradley Wright-Phillips, who found the net twice in the intense and entertaining confrontation. Wright-Phillips, whose goals in the 41st and 64th minutes were sandwiched around Villa’s first, has scored 10 goals in eight games against City.

The win clinched the season series at 2-0 for third-place NYCFC (12-7-4, 40 points), with Game No. 3 at Red Bull Arena on Aug. 25. It extended City’s home unbeaten streak to eight games and snapped the fourth-place Red Bulls’ winning streak at four. They dropped to 11-9-2, 35 points.

“I would have to put it in the top three best games that we played since I’ve coached the team,” NYCFC coach Patrick Vieira said. “It was really difficult for us because the Red Bulls are a fantastic team and really played well.”

advertisement | advertise on newsday

But City played better when necessary. Villa increased his goal total to 17 and again demonstrated why he is the captain and team leader.

“I try to do my best always,” he said. “I try to show every young player that I always give 100 percent on the pitch. If they see me like a leader, it’s a pleasure to me.”

Villa took center stage in the 72nd minute when he beat goalkeeper Luis Robles with a solo effort near the right post to equalize at 2-2. After Sal Zizzo fouled him in the box, Villa drilled a penalty kick into the lower left corner for the game-winner in the 75th minute (Zizzo was sent off for a second yellow card in the 90th minute).

“He’s a tough guy to deal with,” Red Bulls coach Jesse Marsch said. “You have to be sharp upstairs, you have to be alert for every moment. You can’t give him any space because if you do, he’s going to hurt you. Obviously, a quality player.”

@NewsdaySports