FORT LAUDERDALE, Fla. — From a dream start to a nightmare finish, the Los Angeles Football Club was knocked out of the CONCACAF Champions Cup on Wednesday, falling to Lionel Messi and Inter Miami 3-1 (3-2 on aggregate) following a frantic second quarterfinal leg at Chase Stadium.

Two goals by Messi, including a game-winning penalty kick in the 84th minute, helped Miami survive more than 180 tantalizing minutes between the MLS sides.

Holding a 1-0 lead after last week’s opening encounter at BMO Stadium, LAFC added to their tally 10 minutes in when they exposed Miami and found chunks of space to operate.

With away goals serving as the competition’s first tiebreaker, LAFC accomplished what Miami could not April 2, when goalkeeper Oscar Ustari punched away a corner kick, leaving midfielder Mark Delgado room to float a soft half-volley back into the box.

Nathan Ordaz, standing next to Aaron Long, got a touch on the ball before it fell to the veteran defender, who swooped his attempt into the upper corner. Long’s second-chance goal gave the Black & Gold an edge that forced the hosts to score three times in regulation, providing Steve Cherundolo’s team did score again.

“I think everybody is angry with ourselves,” Ordaz said. “We expect better from ourselves. We want to win championships, not go out in quarterfinals.”

Besides dangerous moments for Denis Bouanga down the left side, LAFC adopted a more defensive posture leading up to the break. Miami took advantage by ramping up its pressure, and the Herons unleashed a torrent of corner kicks while Messi worked to free up his teammates.

At the half-hour mark, Miami’s luck started to turn.

Messi, who had a goal denied minutes earlier, got one to count to even the score.

“I think we made one mistake defensively the entire first half and were punished for it,” Cherundolo said. “If I look at our opponent, they made many mistakes and we didn’t punish them enough. I think that’s where the game was lost.”

Miami put the screws to LAFC in the 61st minute when Noah Allen chipped the ball toward the 6-yard box as Federico Redondo scored on a strange bounce that got past goalkeeper Hugo Lloris.

The sequence set the match on a razor’s edge, yet LAFC was still positioned to advance if it could maintain a 2-2 aggregate scoreline.

“It was a very hard game for us,” Miami coach Javier Mascherano said. “I think the first 25 minutes, they were much better than us. Maybe they deserve to score another goal. They didn’t. They gave us one more life and we did our jobs.

“In football sometimes you have to suffer in the moment, try to keep the mentality high. We knew if we score one goal maybe they will be nervous. They know we have good players, a good team, and players who know how to compete. I think in the end it was a great night for us.”

After a VAR review in the 83rd minute, Messi stepped up and scored the penalty to lead Miami into the semifinals.