José Rafael de Gallegos y Alvarado (31 October 1784, Cartago, Costa Rica – 14 August 1850, San José, Costa Rica) was the second President of Costa Rica, from 1833-1835. He later served as eleventh Head of State of Costa Rica, from 1845-1846. Gallegos was married twice. His second wife was Ignacia Sáenz y Ulloa whom he married in 1822. He had eight children from his second marriage.