Soccer superstar Lionel Messi scored a spectacular late game-winner in his debut for Inter Miami on Friday night to earn his first win for the team.

With the score tied 1-1 with Mexican club Cruz Azul in the sold-out League Cup game, the Argentine striker fired a free kick into the top left corner of the goal in front of more than 20,000 fans at the DRV PNK Stadium.

Messi started the night on the bench building up suspense as he warmed up along the touchline, before coming onto the pitch in the second half, replacing midfielder Benjamin Cremaschi.

But his debut got off to a harrowing start, as Azul’s Uriel Antuna hit a powerful low shot to equalize shortly after he came on.

If he had missed the free kick, the game would have gone to a penalty shootout. Instead, Messi ended it on his terms in the 94th minute.

«What I saw was the goal,» Messi said in an interview on the pitch amid the post-match celebration. “I saw the goal. I knew I had to score.»

It took Inter Miami four years of planning and two years of searching to bring Messi, a seven-time Ballon d’Or winner and World Cup champion, to the club.

«It was worth it,» team co-owner David Beckham said earlier in the week.

The game was attended by celebrities from Serena Williams to Kim Kardashian. NBA legend LeBron James also greeted Messi from the stands before the game with a big hug.

Thousands of fans also turned out to welcome him to Miami and Major League Soccer on Sunday, in a rain-drenched ceremony complete with fireworks and musical performances.

The player’s move to the city has inspired a great deal of excitement and pride in South Florida, particularly among its broader Argentinian and Latino communities. major league soccer has sometimes had trouble connecting with his Latino fan base, although his growth in popularity has coincided with the growth of the Latino population in the US.

Lionel Messi celebrates after scoring his winning goal for Inter Miami against Mexican team Cruz Azul.Stacy Revere/Getty Images

Messi’s multicultural appeal has energized the city and has drawn more international stars to the team. His former Barcelona teammate Sergio Busquets has also joined Inter Miami, and Jordi Alba is expected to sign soon. Inter owners Jorge Mas and Beckham recently told The Miami Herald.

Major League Soccer has traditionally had a reputation as a place where players from Europe’s top leagues come to retire. Brazilian soccer icon Pelé joined the New York Cosmos, part of the North American Soccer League in 1975, two years before leaving the sport. David Beckham joined the LA Galaxy in 2007 at the age of 32.

But Messi’s arrival could help move the needle to the next level in terms of profitability and awareness as the league makes significant gains in viewership, media rights and spending.

Messi himself will earn between $50 million and $60 million a year with Inter Miami, and almost certainly $1 million per game, according to the Associated Press. His contract is set at two and a half years.

Associated Press contributed.