When Did Spain Gain Territory