Van Gaal masterminded a 2-0 victory against Chile, while Mata scored Spain’s third goal in their 3-0 win over Australia.
Leory Fer and Mephis DePay scored the Dutch goals to preserve van Gaal’s perfect record at the tournament so far and the Netherlands will now face the Group A runners-up – likely to be Mexico or Croatia, although it could also be hosts Brazil – on Sunday at 17:00 BST.
Robin van Persie, who missed Monday’s game against Chile because of suspension, will almost certainly return to the Dutch side to spearhead their knockout-phase charge.
Sadly for Juan Mata and his team-mates, Spain will watch the rest of the competition from back home, having had their fate confirmed before their final group clash with Australia.
It took 36 minutes in Curitiba before the first clear-cut chance of the game emerged and David Villa, who had announced plans to retire from international football after the tournament, ensured he signed off in style by netting the opener with a cheeky backheel.
Mata replaced Villa with just over half an hour to play to get his first taste of action in this year’s tournament and he found the net on 82 minutes with a cool finish from close range. Cesc Fabregas picked out Mata at the back post and, after taking a touch to bring the ball under control, the Reds midfielder calmly slotted the ball through