A huge storm bearing down on the Pacific coast of Mexico has strengthened to a hurricane just hours before it is due to make landfall.