[Read: Neymar's 100 on 100]
In the match held at the 41,000-people strong Arena Pernambuco, Mexico needed just to avoid defeat in Recife to take their place in the knockout phase, but three goals in 10 second-half minutes killed off Croatia's hopes.
FINAL GROUP A STANDINGS
Brazil: Played 3, Won 2, Drawn 1 Goals For 7, Goals Against 2, Points 7
Mexico: Played 3, Won 2, Drawn 1, GF 4, GA 1 Points 7
Croatia: Played 3, Won 1, Lost 2, GF 6, GA 6, Pts 3
Cameroon: Played 3, Lost 3, GF 1, GA 9, Points 0
The Mexicans needed more than an hour to break the deadlock at the Arena Pernambuco before the floodgates finally burst.
Mexico conceded a goal for the first time in the 2014 WC in their 3rd match
Marquez scored with a header on 72 minutes before Andres Guarado grabbed Mexico's second and substitute Javier Hernandez netted a third in quick succession to book their Dutch showdown on Sunday in Fortaleza.
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.
Coach Niko 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 Miguel 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 Guarado 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 on 89 minutes.