The Spanish-American War lasted only a few months and was over when Spain signed a peace treaty giving the United States control of Cuba, Puerto Rico, the Philippine Islands, and Guam. Cuba, however, became an independent country rather than a U.S. territory.