Brooks saw combat in both the Second Seminole War and the Mexican–American War. He participated in the battles of Battle of Palo Alto and the Battle of Resaca de la Palma in 1846. He saw considerable action in the Battle of Monterrey, and received a brevet to captain for "gallant and meritorious conduct." The following year, Brooks was at the Siege of Vera Cruz, the Battle of Cerro Gordo, the Skirmish of Ocalaca, the Battle of Contreras, and Battle of Churubusco. He was received a brevet promotion to major, August 20, 1847, for gallant and meritorious conduct at Contreras and Churubusco. He served on the staff of Gen. David E. Twiggs for the rest of the war.