Lionel Messi scored twice, including a brilliant late equaliser, as Inter Miami advanced past FC Dallas to the quarter-finals of the Leagues Cup on penalties after an enthralling 4-4 draw.

A trademark curling free-kick in the 85th minute, Messi's seventh goal in his fourth game for Miami, took the game to the shootout after Miami had trailed 4-2 with 10 minutes to go.

The Leagues Cup, the tournament for clubs from Major League Soccer and Mexico's Liga MX, does not feature extra-time with drawn games going directly to penalties.

Messi put Miami ahead in the sixth minute with a clinical side-foot finish from a Jordi Alba pull-back. 

It was initially ruled out for offside but the decision was reversed after the referee, on review, ruled that Josef Martinez had not blocked the view of the goalkeeper.

Dallas drew level in the 37th minute through Argentine Facundo Quignon, who connected with a fine pull-back from overlapping full-back Marco Farfan.

The home side grabbed the lead on the stroke of half-time with an outstanding finish from Bernard Kamungo who left two defenders behind before burying the chance.

Another of Dallas's Argentine players, Alan Velasco, made it 3-1 in the 63rd minute with a free-kick from the left which flew untouched through a crowded box and into the far corner.

Miami narrowed the deficit through teenage substitute Benjamin Cremaschi who slotted in a low ball from Alba, just a minute after coming off the bench.

An own goal from Robert Taylor, as he tried to intercept a Paul Arriola pass, restored the two-goal cushion for Dallas at 4-2.

Messi then chipped a free-kick into the box and Farfan, unchallenged, inexplicably headed into his own goal to keep Miami alive.

Five minutes from the end Messi strode up and curled a free-kick from 20 yards superbly into the top corner to take it to penalties.

Messi converted the first penalty in the shoot-out, Paxton Pomykal missed for Dallas and Cremaschi secured Miami's place in the last eight with the final spot-kick.