Javi Marquez scored one memorable goal in the waning seconds. (Photo courtesy of the Cosmos)

MIAMI — Javi Marquez tallied in the second minute of stoppage time to boost the Cosmos into a 3-3 draw with Miami FC in North American Soccer League action Wednedsay night.

Jaime Chávez scored all three goals for the hosts.

The Cosmos drew first blood in the 10th minute when a cross into the box flew past an outstretched Vega, bounded off Dejan Jakovic and found its way to Bljedi Bardic, who struck home into an open net to give New York a 1-0 lead.

A flurry of action on two corner kicks just minutes later nearly saw Miami draw level with the Cosmos. Rhett Bernstein was on the end of both corners. On the second he got hold of a Hunter Freeman cross and headed a shot that ricocheted off the crossbar.

Miami connected for the equalizer late in the first half, with Chávez the protagonist. Freeman, a former Cosmos defender, swung in a free kick that was met by Bernstein, who directed his header forward and found Chávez unmarked near the edge of the six-yard box. Chávez powered his volley past Cosmos goalkeeper Kyle Zobeck to draw level at 1-1.

In the 63rd minute, after a series of comical missed clearances from the Cosmos in their own box, Chávez found himself with the ball at his feet and plenty of time and space in front of goal. He curled in a shot and to give the Orange and Blue a 2-1 lead.

But the Cosmos answered Miami’s goal with one of their own in the 81st minute. Márquez got loose on the right side of the box and slinged a quick pass across the face of goal that was one-timed off the crossbar and into the goal by Pablo Vranjicán.

Chávez netted his hat-trick in the 90th minute of the match with a stellar right-footed strike from the left corner of the box that scooted past Zobeck to put Miami ahead 3-2.

As they did throughout this match, the Cosmos would not stay down. In the 92nd minute, Márquez found a sliver of space in Miami’s box and uncorked an unstoppable shot to tie the match at 3-3.

The Cosmos, who Saturday game at Puerto Rico FC was postponed due to Hurricane Irma, return to MCU Park for a rematch against Jacksonville Armada FC Sunday, Sept. 17 at 5 p.m.

Scoring summary

10′ – Bardic (NYC) | Assisted by Jakovic
44′ – Chávez (MIA) | Assisted by Bernstein
63′ – Chávez (MIA)
81′ – Vranjicán (NYC) | Assisted by Márquez
90′ – Chávez (MIA)
90’+2′ – Márquez (NYC)