From 1521 to 1821 it was a Vicerroyalty (a colony of Spain).
From 1821 to 1822 it became an "Empire" (but such government was quickly changed)
From 1822 to this date is has been a Republic, with occasional periods of political turmoil (for example, from 1863-1867 when France invaded Mexico and installed a puppet imperial regime) where Mexico had no official government or had non-recognized governments.