Spain's population dropped by a little under 114,000 to 46.7 million last year as many of the country's foreign residents opted to leave in the wake of a five-year economic crisis.

The National Statistics Institute said Tuesday a total of 476,748 people left Spain last year while 314,358 moved to the country.

Of those that left, 417,023 were foreigners. Spain has 5.5 million foreigners registered as residents.

The Spanish economy has been in recession for most of the past four years following the collapse of its credit-fuelled real estate sector in 2008.

The population had grown by nearly a fifth in the decade before the crisis erupted, with foreigners flocking to the country for work.