When the final whistle blew confirming the final of NYCFC 3, Red Bulls 2 on Sunday at Yankee Stadium, the winning coach hugged his star player so hard you immediately wondered two things:

Was Patrick Vieira going to inadvertently injure David Villa with his death grip?

And, would Vieira ever let go?

“It was all love,” Vieira said with a smile about his emphatic bear hug of Villa, who scored all three NYCFC goals.

Perhaps the only surprising element to what Villa, the Spanish superstar, did Sunday was the fact that it was his first career MLS hat trick.

Villa, who now has 17 goals this season coming off his virtuoso MVP performance in 2016, scored one more goal than the Red Bulls’ underrated star striker Bradley Wright-Phillips.

At the end of this highly entertaining rivalry match before a spirited sellout crowd of 33,679, the final score was as much David Villa 3, Bradley Wright-Phillips 2 as it was NYCFC 3, Red Bulls 2.

Villa’s third goal, which came on a penalty kick in the 75th minute after a Sal Zizzo foul, was the difference.

Three minutes earlier, Villa scored the most artistic of his three goals, out-running and out-maneuvering Red Bulls defenders Damien Perrinelle, Sacha Kljestan and Felipe to beat keeper Luis Robles and tie the game at 2-2.

Villa had given NYCFC a 1-0 lead on a fluke, freebie goal of sorts in the 28th minute when Red Bulls defender Aaron Long’s pass deflected hard off the chest of NYCFC’s Alexander Ring. The ball bounded free to Villa, who was all alone giving Robles no chance on the breakaway.

Wright-Phillips scored the equalizer in the 41st minute with a terrific left-footed shot that wrong-footed NYCFC keeper Sean Johnson.

BWP then gave the Red Bulls a 2-1 lead with a textbook one-timer off a Tyler Adams cross.

“It was like those two were throwing punches,” Red Bulls coach Jesse Marsch said of Villa and Wright-Phillips. “Bradley is

our version of David Villa for them.”

Watching these two stars trade punches Sunday was great theater, a thorough treat.

And, knowing what each has meant to his team makes you wonder where either team would be without its star striker. It makes you wonder where MLS soccer in New York and New Jersey would be without Villa and BWP.

Wright-Phillips, who has 13 goals this season, has scored 10 goals in the eight matches against NYCFC.

“He loves these games,” Marsch said of BWP. “He really relishes the big stage and these big games.

“If you go through the history of this series, he’s been the best player over the 2 ¹/₂ years. Bradley is an amazing guy, an amazing leader and a great player.

“Two goals, just classy finishes. It should have been enough to walk out of here with at least a draw if not three points.”

Except for Villa, of course.

“David is our leader,” Vieira said. “When he plays like that the team and players follow. When David plays well the team plays well. And today was David.”

When it was over, Villa offered praise for his goal-scoring counterpart, calling BWP “one of the best in MLS — not only now, in this season, but in the history.”

“He scores a lot, he’s always dangerous,” Villa said. “He did it again today. But we are happy because we scored one more than him.”

Correction: Villa scored one more than him.

Villa 3, BWP 2.