The Messi magic continues as the World Cup winner delivered a spectacular free kick late in Inter Miami’s Leagues Cup match with FC Dallas, tying the game 4-4. Miami ultimately won on penalty kicks.

In the 85th minute of Sunday’s game, Lionel Messi — facing a 4-3 deficit — stepped up to take a free kick approximately 20 yards from the goal. Despite a strong attempt from the FC Dallas keeper Maarten Paes, Messi’s shot hit the right upper 90 and found the back of the net.

Messi scored twice in the contest which saw Miami leading early, falling behind 3-1 then 4-2, but ultimately winning on PKs, 5 to 3.

With the victory, Inter Miami advanced to the Leagues Cup quarterfinals.

INTER MIAMI CELEBRATES LIONEL MESSI'S ARRIVAL; SOCCER GREAT OFFERS WARNING ABOUT MLS EXPECTATIONS

Messi celebrating

Lionel Messi, #10 of Inter Miami CF, celebrates after making his penalty kick attempt during the Leagues Cup 2023 Round of 16 match between Inter Miami CF and FC Dallas at Toyota Stadium on Aug. 6, 2023 in Frisco, Texas. (Alex Bierens de Haan/Getty Images)

The high-scoring contest started mere minutes into the match, with Messi, who was signed to Miami over the offseason, scoring with his signature left foot in the sixth minute.

The goal came just outside the 18-yard box.

Then FC Dallas rallied with goals from Facundo Quignón in the 37th minute and Bernard Kamungo just before halftime in the 45th.

Dallas players

Facundo Quignon, #5 of FC Dallas, celebrates his goal with teammates in the first half during the Leagues Cup 2023 Round of 16 match between Inter Miami CF and FC Dallas at Toyota Stadium on Aug. 6, 2023 in Frisco, Texas. (Alex Bierens de Haan/Getty Images)

Coming out of the 2-1 halftime score, FC Dallas increased their lead with a goal from Alan Velasco in the 63rd minute.

A goal from Miami’s Benjamin Cremaschi push the score to 3-2 but an own goal from Miami’s Robert Taylor push the score to 4-2.

After subs from both teams, Dallas’ Marco Farfan scored an own goal, setting up the 4-3 scoreline.

Then, Messi stepped up to score again.

Messi shooting

Lionel Messi, #10 of Inter Miami CF, makes his penalty kick attempt during the Leagues Cup 2023 Round of 16 match between Inter Miami CF and FC Dallas at Toyota Stadium on Aug. 6, 2023 in Frisco, Texas. (Alex Bierens de Haan/Getty Images)

A few moments later, Messi slipped another ball past Paes as Messi took the first of his team’s PKs.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

During the penalty shootout, goals for Miami came from Messi, Sergio Busquets, Leonardo Campana, Kamal Miller and a game-winner from Cremaschi.

Quignón, Paul Arriola and Jesus Ferreira scored penalty kicks for Dallas.

CLICK HERE TO GET THE FOX NEWS APP

The Miami team

Inter Miami CF starting squad poses prior to the Leagues Cup 2023 Round of 16 match between Inter Miami CF and FC Dallas at Toyota Stadium on Aug. 6, 2023 in Frisco, Texas. (Alex Bierens de Haan/Getty Images)

Inter Miami and Messi will play again on Aug. 11. They will face the winner of Charlotte FC and Houston Dynamo FC, who play Monday, Aug. 7.

Messi will be with Inter Miami through the 2025 season.