Mexico needed just to avoid defeat in Recife to take their place in the knockout phase, but three goals in ten second-half minutes killed off Croatia's hopes.
The Mexicans needed more than an hour to break the deadlock at the Arena Pernambuco before the floodgates finally burst.
The 35-year-old Marquez, captaining his country at a record fourth finals, scored with a header on 72 minutes before Andres Guardado grabbed Mexico's second.
Substitute Javier Hernandez then netted their third in quick succession to book their Dutch showdown at 1300 local time (1600GMT) on Sunday in Fortaleza.
"That is one of the happiest days of my life," beamed Mexico coach Miguel Herrera.
"It was a hard fight, but my team pulled through."
Ivan Perisic grabbed a late consolation for the Croats before replacement forward Ante Rebic was sent off just before the final whistle.
Croatia bow out by finishing third in the group after their opening 3-1 defeat to Brazil and 4-0 trouncing of Cameroon, while Mexico finish second in the table to Brazil on goal difference.
"We kept the game open for a long time, but two corners decided the game," said Croatia coach Niko Kovac.
"We weren't bad, but the opponent was better today."
Kovac had recalled defender Sime Vrsaljko for Croatia, with left-back Danijel Pranjic pushing up into midfield, but it was a move that ultimately didn't pay off.
The Mexicans were unchanged from the side that held hosts Brazil to a goalless draw last Tuesday thanks to the heroics of goalkeeper Guillermo Ochoa.
Mexico coach Herrera opted to again leave Hernandez out of his starting line-up before the Manchester United star netted after coming on for the final 25 minutes.
The Mexicans had the best of the opening exchanges when Hector Herrera's long-range shot beat Croatia goalkeeper Stipe Pletikosa but thundered off the crossbar on 16 minutes.
Croatia fired in numerous crosses, but Mexico goalkeeper Ochoa was again solid between the posts.
After a goalless first-half, the Mexicans got the breakthrough when Herrera's corner was powered home after Marquez out-jumped the defence on 72 minutes.
Croatia threw everything forward to find an equaliser, but left spaces at the back which Mexico exploited with their second goal just three minutes later.
Valencia's Guardado finished off a lightning counter-attack on 75 minutes to leave Croatia on the ropes.
Mexico then grabbed their third when another Herrera corner was flicked on by Hector Moreno for Hernandez who nodded home at the back post on 82 minutes.
Perisic grabbed a late goal for Croatia when he converted Ivan Rakitic's final pass just before Rebic was shown a straight red for taking out Carlos Pena a minute from time.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ