The policy of manifest destiny increased tensions with Mexico in the 1840s. Mexico's northern half formed the western border of the territory bought in the Louisiana Purchase. Naturally, notions of the United States expanding to the Pacific Ocean alarmed Mexico, which held what is today the west coast of the United States.
However, Mexico first came to regard American expansion as a serious problem with the immigration of Americans into its northeastern territory. These Americans declared independence from Mexico and created a nation in the Mexican province of Texas. After winning independence in 1836, Texas became an independent republic.
Texas formally asked to be annexed by the United States in 1845. This annexation angered the Mexican government, which still considered Texas to be part of its territory. Mexico had previously warned that the annexation of Texas would cause Mexico to declare war on the United States.
When a Mexican patrol attacked American cavalry in the disputed area north of the Rio Grande, President Polk went to Congress for a declaration of war. The declaration passed on May 13, 1846. The war against Mexico was unpopular with the opposition Whig party, especially in the North. Opponents of the war denounced it as a war of aggression, and denied that there had been a valid reason for war.
Small American military units were quickly able to occupy key points in California, including San Francisco and Los Angeles. Although California was sparsely populated, some Mexican inhabitants formed an effective resistance which was eventually put down in 1847 by American reinforcements. Subsequently, a larger American army was sent to invade central Mexico, and managed to capture the Mexican capital, Mexico City, on September 13, 1847. Although a large Mexican army was still fighting American forces in northeast Mexico and Texas, news of the capital falling caused it to retreat to try to retake the capital. After the defeat of the last Mexican army, major hostilities ended.
In 1898, one of Spain's last possessions in the New World, Cuba, was waging a war for independence, and though Cuba was technically exempted from the Monroe Doctrine because it was already a Spanish territory when the Monroe Doctrine was issued, many Americans believed that the United States should side with Cuba against Spain.
Initially, Republican President William McKinley wanted to avoid any wars, and for its part, Spain also wanted to avoid any conflict with United States and its powerful navy. However, Spain also wanted to keep Cuba, which it regarded as a province of Spain rather than a colony. Cuba was very important to the Spanish economy as well, as it produced valuable commodities such as sugar and also had a booming port at Havana.
Despite President McKinley's wishes to avoid a war, he was forced to support a war with Spain after the American navy vessel USS Maine suffered an explosion in Havana harbor. McKinley had sent the ship there to help protect American citizens in Cuba from the violence that was taking place there, but the explosion devastated the ship, which sank quickly in the harbor. Two hundred sixty-six American sailors aboard the USS Maine died.
Although the Spanish fought the US Army to a stalemate in Puerto Rico, Spain was forced to make peace after the US Navy destroyed both its Pacific and Atlantic fleets. The military defeat in Cuba meant that Spain would have to give Cuba its independence, and the destruction of its navy meant that Spain would have to cede its overseas colonies to the United States. The United States subsequently gained possession of the Philippines, Puerto Rico and Guam, marking the true beginning of American imperialism.