More on Germany:
More on Mexico:
Photo of the Day
But Klinsmann pounced on a mistake by defender Raul Lara to stab home a cross from Dietmar Hamann for the equaliser in the 75th minute.
And with just four minutes left Bierhoff, who hit the bar in the first half with a simple chance, rose to head a cross from Ulf Kirsten just inside the right-hand post to crush Mexican resistance.
Berti Vogts' men now face the winners of Tuesday's quarter-final between Romania or Croatia in Lyon.
"I have to congratulate my team on the way they battled back from what looked like defeat to stay in the competition," Vogts said. "The way they worked for 90 minutes and battled was amazing."
"It was hot out there even in the shadow and, despite that, the players gave their all. That was by far our best performance and we will improve further."
Klinsmann added: "That Mexican goal was like a cold shower at the start of the second half. But we showed amazing fighting spirit. There is a huge amount of character in this team."
Hernandez's brilliant individual effort two minutes into the second half shocked a German defence which had lost veteran Juergen Kohler before the kick-off after he injured himself in the warm-up.
Indeed the Mexicans could, and perhaps should, have gone two up soon after their flaxen-haired striker had scored.
The German defence looked slugglish when El Matador picked up a short pass from Cuauhtemoc Blanco and weaved his way past Michael Tarnat and Christian Woerns before firing the ball past German 'keeper Andy Koepke.
In the 61st minute the Mexicans might have scored again when substitute Jesus Arellano broke away on his own down the right. Libero Lothar Matthaeus tried to tackle but indavertently hit the ball goalwards.
Koepke managed to turn the ball on to the right-hand post and Hernandez weakly fired a second shot into the keeper's arms with the goal at his mercy.
Numerous teams have learnt you cannot give the Germans a second chance, and sure enough they bounced back.
Klinsmann demonstrated he has lost none of his finishing prowess in his last World Cup to score before Bierhoff, the hero of Germany's Euro 96 triumph, underlined he is one of the world's most dangerous players in the air.
"The Mexicans played well but I think we deserved to win over the 90 minutes," Bierhoff sad. "It is great to score the decisive goal but Klinsmann did the business too."
Klinsmann and Bierhoff each scored twice in first round matches. But their two goals against the Mexicans may be the most precious they will ever score for their country.
The Germans had their chances to take the initiative in the first half of a match played in afternoon temperatures of more than 30 degrees centigrade.
In the 38th minute wing back Tarnat hit a fierce shot from outside the penalty area which Mexican 'keeper Jorge Campos did well to save, diving to his left in spectacular fashion to save one-handed.
Two minutes later Bierhoff went desperately close to scoring when he hit the bar with a header with Campos stranded.
Mexico played lively, quick-passing soccer for 90 minutes and were Germany's equal in all areas of the field for long stretches of the game. Campos was superb, but in the end German experience won through.
"It was very difficult. I'm extremely proud of our players," said Mexican coach Manuel Lapuente.
"For a moment I though we might win. We lost, but we lost battling and giving our all."
Germany were knocked out by Bulgaria in the 1994 quarter-finals while Mexico have not reached the last eight since 1986, when they were beaten by West Germany.
The Germans, who have reached the final six times since 1954, winning three times, have gone out in the second round just once before in the 1978 finals in Argentina.
© 1998 SportsLine USA, Inc. All rights reserved