It was established in 1898 , when the United States obtained control of Cuba from Spain at the end of the Spanish-American War , following the 1898 invasion of GuantÃ namo Bay . It was established in 1898 , when the United States took control of Cuba from Spain following the Spanish-American War .