Second-half substitute De Nigris scored an equaliser for Mexico in the 48th minute after Carlos Ruiz's fifth-minute strike had put Guatemala ahead. Hernandez scored the match-winner in the 65th minute as Mexico advanced to a semi-final match with Honduras, who advanced 4-2 on penalties over Costa Rica after they played to a 1-1 draw in extra time.
Mexico stayed on course for a title repeat despite a squad reduced down to 17 men after the national federation withdrew five players who tested positive for banned clenbuterol at a pre-tournament training camp in May.
Guatemala came out clearly focused on pulling off the upset, and Ruiz's quick strike shocked the pro-Mexico crowd.
Elias Enoc Vasquez's long pass started the play. After Mexican defender Hector Moreno failed to kick the ball clear, Guatemalan captain Ruiz floated it over Mexico keeper Alfredo Talavera. Ruiz came close again in the 73rd minute, with Talavera making a narrow save of his 25-yard shot to keep Mexico ahead.
Mexico, whose 14 first-round goals were seven more than any other team in group play, made one substitution at halftime as De Nigris replaced Israel Castro and made an immediate impact.
The remaining two quarter-finals are slated for Sunday in Washington, where the United States will face Jamaica and Panama take on El Salvador in the regional championship for North and Central America and the Caribbean.
The winners of the Gold Cup tournament will secure passage to the 2013 FIFA Confederations Cup in Brazil.