Puerto Rico was ceded by Spain in the aftermath of the Spanish–American War under the terms of the Treaty of Paris of 1898 and became an unincorporated territory of the United States. On October 18, 1898, formal possession of the island was assumed and the American flag raised over the fortifications from which the emblem of Spain had flown for nearly four centuries.