Herrera replaces Victor Manuel Vucetich, who coached only two matches. The last was a 2-1 loss on Tuesday against Costa Rica.
Herrera, who is leaving as coach of Mexican Club America, is Mexico's fourth coach in just under two months as the team struggles to reach its sixth straight World Cup.
Mexican federation officials said they would evaluate after the two matches to decide if Herrera will continue.
''This is a crisis situation we are going through,'' said Justino Compean, president of the Mexican football federation. ''Nobody planned for this and nobody likes it. We are sorry for our fans, we are saddened along with our club owners, and we are sorry for our sponsors.''
Mexico was lucky to reach the playoff. Panama missed out when it lost to the United States 3-2 on Tuesday after two stoppage-time goals. Panama was leading 2-1 after an 83rd-minute goal, a result that would have eliminated Mexico from the playoff.
Once the regional football power, Mexico had a poor World Cup qualifying campaign and managed only 11 points in 10 matches. It also played badly four months ago in the Confederations Cup, a warm-up for the World Cup.
The United States, Costa Rica and Honduras claimed the three automatic qualifying berths from the CONCACAF region, which takes in North America, Central America and the Caribbean.
Herrera is the eighth coach in the last seven years, a sign of the instability surrounding Mexico's national sport.
Jose Manuel De la Torre was fired in early September and replaced with interim coach Luis Fernando Tena. He was replaced by Vuectich.
''Of course this is not ideal, and nobody likes to keep changing coaches,'' Compean said. ''When we hired De la Torre, we did it with the intention that he would stay with us through the World Cup cycle. But the results weren't there, and when the results aren't there you have to make decisions.''