Buchanan participated in the Mexican War in command of the Maryland Volunteers. He was in the Battle of Chapultepec, the Battle of Palo Alto, the Battle of Resaca de la Palma, the Battle of Molino del Rey, and the capture of Mexico City. For his service in Mexico, Buchanan was twice brevetted in recognition of his gallantry in action. In 1847 Buchanan became a veteran member of the Aztec Club of 1847 – a military society of officers who had served in the Mexican War.