During the Mexican–American War, Granger fought in Winfield Scott's army. He took part in the Siege of Veracruz, the Battle of Cerro Gordo, the Battle of Contreras, the Battle of Churubusco, and the Battle for Mexico City. Granger received two citations for gallantry and in May 1847 received his regular commission as a second lieutenant. After the war, he served on the western frontier in Oregon and then Texas. In 1853 he became a first lieutenant.