The United States gained control of the former Spanish colonies by going
to war with Spain over Cuba, or more specifically, Cuba's independence.
Together with the filipino rebels, America won against Spain and gained
control of multiple colonies including puerto rico, guam and the
phillipines.