Aly Alberto Hassan scored the game-winner in the 89th minute. (Photo courtesy of the Cosmos)

NEW YORK — Second-half substitute Aly Alberto Hassan scored in the 89th minute to snap a 1-1 tie and boost the New York Cosmos to a 2-1 victory over FC St. Pauli of Germany to a 1-1 draw in an international friendly at Rocco B. Commisso Soccer Stadium on Thursday night.

Hassan, who replaced Charlie Ledula in the 78th minute, latched onto an Aaron Dennis feed from the right flank and slid the ball into the back of the net.

The teams traded first-half goals in the entertaining match as supporters from both clubs celebrated and partied together as the Cosmos hosted their first international match in more than three decades.

A minute after goalkeeper Robin Himmelmann produced a kick save on a Bledi Bardic blast, the Cosmos found the back of the net in the sixth minute.

Junior Burgos started the scoring sequence with a corner kick. After a few passes, a ball from the far side of the field sailed to Matt Lewis, standing to the right of the net. The defender nodded the ball to a sliding Emmanuele Sembroni, who slid the ball home from point-blank range for a 1-0 lead.

The lead, however, did not last very long as the visitors equalized in the 15th minute as Sembroni found himself in the middle of that play. The Italian center back was called for a hand ball in the penalty area and captain Sami Allagui drilled the ensuing penalty kick past goalkeeper Santiago Castano into the right corner for a 1-1 deadlock.

Four minutes later, Allagui had a great opportunity to put FC St. Pauli ahead as he broke in alone on Castano, but he took one move too long, allowing the keeper to make a right-handed save.

At halftime, Cosmos chairman Rocco B. Commisso and FC St. Pauli president Oke Gottlich were honored as Adriano Espaillat, the U.S. representative for New York’s 13th Congressional with official proclamations.

Both coaches substituted freely in the second half, which allowed Cosmos head coach Carlos Mendes to empty his bench and give all 10 more field players and goalkeeper Paul Blanchette a chance to play.

The Cosmos last hosted an international match on June 16, 1985, when they dropped a 2-1 decision to Lazio (Italy) at Giants Stadium in East Rutherford, N.J.

The Cosmos, who will have the Memorial Day weekend off, will host Hartford City FC in an NPSL game at Mitchel Athletic Complex in Uniondale, N.Y. on Saturday, June 1 at 8 p.m. ET.

FC St. Pauli will continue its U.S. tour against another National Premier Soccer League team, FC Buffalo, in Buffalo, N.Y. Saturday night.