Brazil were far from their fluid best against Mexico, but Neymar and substitute Roberto Firmino booked them a spot in the last eight.
Much-fancied Croatia needed penalties to advance at the expense of Denmark following their 1-1 draw at Nizhny Novgorod Stadium on Sunday.
Radamel Falcao scored his first World Cup goal as Colombia revived their hopes of reaching the World Cup knockout phase with a 3-0 victory over Poland, who now cannot reach the last 16.
Philippe Coutinho and Neymar conspired to spare Brazilian blushes with injury-time goals to down Costa Rica 2-0 in St Petersburg on Friday.
Striker Eden Hazard could still remain at Chelsea, but has warned he would consider an interesting offer from Real Madrid.
Peru must be wary of Denmark star Christian Eriksen in their Group C opener but have the players to match the Tottenham star, according to head coach Ricardo Gareca.