An inspired tactical change during the second of two official stoppages led to a late goal from Netherlands forward Wesley Sneijder and an injury-time penalty from Klaas Jan Huntelaar in a dramatic 2-1 victory over Mexico on Sunday.

“I moved to ‘Plan B’ at the cooling break,” said Netherlands coach Louis van Gaal, soon to be the manager at Manchester United. “That is a good way to take advantage of those breaks.”

Despite scoring 10 goals in three group matches, Van Gaal again started the match with a defensive 5-3-2 system. He made the switch to a more attacking 4-3-3 formation when referee Pedro Proenca stopped the match in the 76th minute to allow players to rehydrate.

That helped turn the match around and extend Mexico’s second-round curse to six straight World Cups.

“Unbelievable,” said Arjen Robben, the Netherlands forward that earned the late penalty. “Five minutes from full time, we were out.”

Instead of the Dutch players, it was the Mexicans who wilted in the heat as they conceded twice as many goals in the final minutes of the match as they had in the entire group stage.

“The humidity was against us, but we were fresher and fitter than the Mexicans,” Van Gaal said. “Yes, we escaped. But we showed that we could create more chances with 4-3-3, and the players handled this shift very well.”

The Dutch will next face either Costa Rica or Greece in the quarterfinals on Saturday in Salvador.

Mexico coach Miguel Herrera, one of the most popular characters at the World Cup because of his emotive ways on the sidelines, blamed Proenca for the loss and accused Robben of diving under a challenge from Rafael Marquez to earn the penalty.

“Today it was the man with the whistle who eliminated us from the World Cup,” Herrera said. “If a referee invents a penalty, you’re out of the World Cup.

“I hope they have a look at what happened and that this gentleman goes home just like we are.”

Marquez said Robben admitted that it was a bad call, but added that the Dutchman thought he should have been awarded a spot kick for an earlier challenge.

“I spoke with him after the match and he told me that it was not a penalty,” Marquez said. “He said that the first foul was a penalty and that one was not called.”

Mexico has now advanced to the second round at the World Cup six straight times and not reached the quarterfinals. The last time the team made it that far was as host of the 1986 tournament.

Giovani Dos Santos gave the Mexicans the lead in the 48th minute after a goalless first half, but Sneijder equalized with a hard shot in the 88th.

It was the first time Sneijder, who scored five goals at the last World Cup in South Africa, has found the net in Brazil.

Robben, who has already scored three goals for the Dutch at this year’s tournament, then earned the penalty in the fourth minute of injury time but he handed the ball to Huntelaar.

“You don’t know when your chance will come, but it was today, and so you grab it with both hands,” said Huntelaar, who replaced captain Robin van Persie in the 76th minute. “And it was fantastic.”

For Mexico, goalkeeper Guillermo Ochoa was again the star player, pulling off two more great saves after playing a key role in holding Brazil to a 0-0 draw in Group A.

But he couldn’t block Sneijder’s shot and guessed wrong when diving in an attempt to stop Huntelaar’s penalty.

“It isn’t easy to go out this way, the way this match went,” Ochoa said. “It’s just very hard to deal with when victory escapes you this way.”