Heber struck twice in the first half and once in the second for NYCFC. (Brad Penner-USA TODAY Sports)

ALAJUELA, Costa Rica — Heber recorded his first hat-trick for New York City FC, which walked out with a wild 5-3 triumph over San Carlos in its Round of 16 series in the Concacaf Champions League at Estadio Alejandro Morera Soto on Thursday night.

The win and four goals gave the Major League Soccer side a distinct advantage heading into the second leg at Red Bull Arena in Harrison, N.J. on Wednesday, Feb. 26. Since away goals are counted double in an aggregate-goal competition in case of ties, City’s bucket load of goals was vital.

NYCFC became the first MLS team to win its Round of 16 game in the 2020 competition. On Tuesday night, Atlanta United played host Motagua to a 1-1 draw while Leon defeated Los Angeles FC, 2-0. On Wednesday night, the Montreal Impact played a 2-2 draw at Saprissa. Seattle Sounders FC played a late match at Olimpia on Thursday night.

While there were goals aplenty, it wasn’t the neatest defensive game for either team as sloppy seemed to be the order of the night. San Carlos entered the match winless in its last six matches while NYCFC was playing its first competitive match of the year. So, many players’ legs were tested for 90 minutes.

Heber struck twice during a 22-minute span in the opening half as he took feeds from opposite sides of the field to beat goalkeeper Patrick Pemberton.

The Brazil striker lifted the visitors in a 1-0 lead in the 13th minute, sliding home a Ronald Matarrita feed from the left side.

Heber doubled the margin in the 35th minute, as he beat Pemberton from close range, thanks to a right-wing cross from right back Anton Tinnerholm.

Just prior to the halftime whistle, Jorman Aguilar gave San Carlos some hope and life by running onto a ball over the top by Randy Chirino and beating keeper Sean Johnson to the far right post.

NYCFC, however, restored its two-goal advantage at 3-1 in the 52nd minute after defender José David Sánchez was called for a handball in the penalty area. Heber ripped a right-footed shot into the lower left corner as Pemberton dived in the opposite direction.

HIGHLIGHTS | AD San Carlos 3-5 New York City FC

Watch all the goals from last night's Scotiabank Concacaf Champions League debut for New York City's Football Club…

Posted by New York City FC on Friday, February 21, 2020

Video courtesy of NYCFC’s Facebook page

Alex Callens increased the lead to 4-1 in the 63rd minute as he beat his marker and scored from close range.

San Carlos, however, refused to give up as Marcos Mena tallied in the 63rd minute off a feed from Chirino.

Mena almost made it a one-goal game in the 74th minute as he shot was deflected over the goal line for a corner kick.

Only five minutes later, second-half substitute Omar Browne did make it a one-goal game as he powered a 30-yard shot from the left side past goalkeeper Sean Johnson.

Someone finally found a way to stop Heber’s goal-scoring onslaught as NYCFC head coach Ron Deila pulled the forward for Valentín Castellanos in the 64th minute. During that juncture, Maxi Moralez, who is battling a calf injury, came on for Keaton Parks.

Moralez had an opportunity to add the NYCFC goal total after he was taken down in the penalty area in stoppage time. But someone probably did not brief new City head coach Ron Deila that Moralez has experienced nightmares converting penalty kicks. Pemberton made a diving stop to his right to deny the midfielder, but Ronald Mitrita slotted home the rebound two minutes into stoppage time for the final goal of the match.

Lake Grove, N.Y. native Joe Scally made his international debut for NYCFC, replacing Anthon Tinnherholm at right back in the 62nd minute.