The only blemish for the five-time champions was the second-half booking for Casemiro, which rules him out of the quarter-final clash against either Belgium or Japan.
The margin became more comfortable with two minutes left when Firmino - just on as a replacement for Coutinho - added the finishing touch after Neymar had led a counter-attack.
Brazil kept up the intensity as Neymar weaved through two defenders to curl in from an acute angle, but Ochoa spread out his right arm to punch clear.
Brazil maintained the pressure in the second half as Ochoa parried away Coutinho's shot.
Mexico's World Cup is over, ending in a 2-0 loss to Brazil on a sultry Monday evening at Cosmos Arena.
Paulinho nearly doubled the lead before the hour, but his shot inside the box was kept out by the excellent Ochoa, who then had to tip Willian's fizzing drive over the bar. Brazil looks like a strong favorite to reach the July 15 final in Moscow despite being on the same side of the bracket as Belgium and France. With a pair of 2-0 wins over Costa Rica and Serbia, Brazil easily clinched its place at the top of its group.