In 1821, Spain lost continental territories when it recognized the independence of Mexico, as well as Santo Domingo when it was invaded by Haiti that same year. However, Cuba, Puerto Rico and Spanish East Indies (including Mariana Islands and the Philippines) remained a part of the Spanish crown until the Spanish–American War (1898).