The United States acquired Puerto Rico as a result of the Spanish-American War in 1898. Under the terms of the Treaty of Paris, which ended the war, Spain ceded Puerto Rico to the United States. Puerto Ricans were granted American citizenship in 1917.
Guam:
The United States acquired Guam from Spain as a result of the same treaty that ended the Spanish-American War. Guam became an unincorporated territory of the United States. Guamanians were granted American citizenship in 1950.