It was a Pirlo Party in The Bronx.

It was a debut soiree for newly signed Italian midfield maestro Andrea Pirlo, the star attraction of New York City FC’s classy 5-3 win over Orlando.

Sure, NYCFC’s defense showed all the same fragilities, beaten for pace and conceding a hat trick to Cyle Larin. But the suddenly well-oiled offense was so sharp, it didn’t matter. It was the debut of the Pirlo the crowd of 32,041 chanted for at Yankee Stadium, and the Italian star didn’t disappoint. Even mayor Bill de Blasio came into the postgame locker room to meet him.

“Everything went well. I’m very happy. I’m very excited about the victory. It couldn’t be better than this,’’ Pirlo said through an interpreter. “They wanted me to play, so when I got in the pitch it was great to feel the great applause. It was very emotional and I really appreciated it. … Despite the heat it felt great; and since we won, it’s even better.’’

NYCFC — 5-2-2 in their past nine games — won through two goals from David Villa, and three assists by Kwadwo Poku. But the man of the hour was Pirlo, who left Champions League finalist Juventus and inked a 2 ½-year, $2 million deal with NYCFC (6-9-6, 24 points).

The Italian maestro started practice Wednesday, and on Sunday he came on in the 57th minute and looked like he’d been running the team for years. He played teammate Poku into space for two of those second-half assists.

“There’s very few players in history of that kind of level or quality and we have him here with us, so we’re really enjoying it,’’ Villa said through an interpreter.

Villa has scored nine goals in this nine-game hot streak, and says Pirlo and Frank Lampard — hoping to debut next weekend — will help him score even more. “If I can aim right, yes.

“Pirlo and Lampard are those kind of players who give confidence to a team. So not only in the future will we see a great Pirlo, but a great Jefferson [Mena], a great [Javier] Calle. Everyone who plays around him will benefit, and everyone is going to play better because they play next to him.’’

Clearly. It was 2-1 when Pirlo came on, and Larin equalized in the 61st minute. But NYCFC settled the ball on the deck and got goals from Villa in the 67th and Tommy McNamara four minutes later, both on Poku assists. Larin completed the hat trick, but Poku finished a blistering counter with a pass to Mix Diskerud in the 93rd for the final margin.

Despite NYCFC’s defensive woes, Pirlo’s calmness on the ball and vision opened up the field. Afterward, in the bowels of Yankee Stadium, mayor de Blasio asked coach Jason Kreis if Pirlo has only had three full practices “how does he know where to put the ball?”

“He sees things nobody else can see,’’ Kreis replied.

Afterward, Mayor de Blasio addressed the team in the locker room. Then, speaking briefly in Italian with Pirlo, he introduced his son Dante to the star in a hallway.

“It was very emotional for me to meet Mr. Mayor,” said Pirlo. “ Mr. de Blasio came. It was a pleasure to meet him. I gave him a jersey and it was great to see him.”