The PSG forward slid home in the second half and then teed up Roberto Firmino late on as the five-times champions beat an otherwise stubborn Mexico, whose World Cup began with such promise with a victory over champions Germany, but ended in familiar fashion in the first knockout round.
It was the seventh World Cup running that Brazil have reached the last eight, where they will now face Belgium or Japan, while Mexico have not made it to that stage since they hosted the tournament in 1986.
Mexico, who enjoyed an enviable recent record against Brazil having won seven of their previous 15 matches against them, were a threat on the counter in the first half but then faded without ever really being put to the sword.
Brazil had to wait until the 88th minute to put the match to bed as Neymar was the architect, crossing for Firmino to tap the ball home.
They will have to do without defensive midfielder Casemiro in the quarters, however, after he picked up his second booking.