MADRID- 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 percent 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 percent 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.

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. 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 NHH.MC 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.

(Reporting by Alba Asenjo; Editing by Paul Day and Gareth Jones) ((Alba.AsenjoDominguez@thomsonreuters.com; Reuters Messaging: alba.asenjodominguez.thomsonreuters.com@reuters.net + 34 915852183; Twitter: @ReutersEspana))