The result condemned the unfortunate Mexicans, who were 1-0 up with two minutes to go and seemingly headed for the last eight for the first time since 1986, to a sixth second-round exit in six consecutive tournaments.
Dutch midfielder Wesley Sneijder broke Mexican hearts when he drilled home an unstoppable half-volley to equalise after a knock down from Huntelaar following a corner.
With extra time looming, the Netherlands’ livewire winger Arjen Robben weaved into the penalty area and went down under a challenge from Mexico captain Rafael Marquez.
The Portuguese referee Pedro Proenca pointed to the spot and Huntelaar calmly sent goalkeeper Guillermo Ochoa the wrong way with a perfectly executed penalty kick.
The Dutch, who were on the back foot for much of the game, will play either Greece or Costa Rica in Salvador next Saturday and will fancy their chances of making the last four.
It was a heart-breaking end for Mexico, who have now reached the last 16 at every World Cup from 1994 and always lost.
Their last quarter-final appearance was in 1986 on home soil and the only other time they made it to the last eight was in 1970, when the finals were also in Mexico.
“The tension was unbelievable, I’ve never lived through anything like that,” Dutch defender Daley Blind said. “We showed a lot of character in coming back. We couldn’t find our men with our passes in the first half, we struggled to get to the ball, but we came back stronger in the second.”
Robben had two earlier appeals for penalties turned down, and Mexico coach Miguel Herrera accused the Dutchman of diving.
“Three times he dived,” he said. “We’d done really well but then we sit back and we start to give chances to a team that hadn’t done anything.”
Netherlands coach Louis Van Gaal praised his players’ stamina on a searingly hot day at the Castelao arena.
“Until the very last minute we were fresher and fitter than the Mexicans,” he said. “My players deserve a big compliment. Not only did they have belief and faith that they could perform today, they were also fit for this match.”
Mexico dominated the early exchanges while the Netherlands’ best chance of the first half came at the end, when some sloppy Mexican defending let Robben in on goal.
As he teed up a shot, defender Hector Moreno intervened with a desperate sliding tackle and appeared to catch Robben’s trailing foot. The Dutchman went down and appealed for a penalty but the referee waved play on.
The Mexicans took the lead just after the break through striker Giovani Dos Santos, who chested the ball down 30 metres from goal before firing a low left-foot shot into the bottom corner of the net.
The Dutch almost equalised 10 minutes later when their big centre back Stefan De Vrij forced a brilliant reflex save from Guillermo Ochoa in the Mexican goal. He parried the effort on to his left hand post and his defenders cleared it to safety.
Then came the Netherlands onslaught and the last-gasp drama, which saw them snatch victory from the jaws of defeat and keeps alive their hopes of winning the World Cup for the first time.
(Corrects to last eight in second para)
(Repoerting by Gideon Long, editing by Ken Ferris)