The number of international tourists visiting Spain broke records for a fifth straight year in 2017, despite Islamist militant attacks in Catalonia and political uncertainty over its independence movement, government statistics showed.

Spain, where tourism accounts for around 11% of the economy, has seen a surge in international visitors partly due to security concerns in other popular holiday destinations such as Egypt and Turkey.

Preliminary data released late on Wednesday showed the number of visitors arriving in Spain rose 8.9% year-on-year to 82 million tourists, which would make Spain the world's second most visited country after France and push the United States into third place.

Figures showed that tourist spending also hit a new record in 2017, rising 12.4 percent in the year from 2016.

According to final data for the first 11 months of 2017, also released on Wednesday, British tourists remained Spain's largest group of visitors by nationality, accounting for 18 millions tourists, up 7 percent from a year earlier.

Top 10 guide to the best beaches in Spain you need to visit at least once in your lifetime

Catalonia remained Spain's most visited region in 2017, despite two attacks at major tourist haunts in August which left 16 people dead and more than 100 people injured.

Tourism in the region's capital Barcelona dipped slightly after the attacks, then dropped again in October after an illegal independence vote prompted scenes of police violence and mass protests, but it has since rebounded.

Tourism has also seen benefited from a boom in renting flats out to tourists via web platforms such as Airbnb .

Panorama and view on the skyline of Playa de Palma de Mallorca, Spain (
Image:
E+)

However, this has prompted a backlash in popular destinations such as Barcelona, Palma de Majorca or San Sebastian as locals complain of a drop in long-term rentals and rising prices.

The tourism surge has raised business activity in the sector, including increased merger and acquisition interest between hotel groups and expected passenger records at Spanish airports.

On Wednesday, NH Hotels declined a takeover offer by rival Barcelo, an operation which would have created the country's largest hotel chain, though it said it would still analyse future strategic possibilities.