Spain last year surpassed the United States to become the world's second most visited country after France, Spanish Prime Minister Mariano Rajoy said during a visit to Italy.
Rajoy, speaking late on Wednesday, said 82 million people visited in 2017, a 9% increase over the previous year that came despite terror attacks and the political crisis in tourism magnet Catalonia.
Tourism earnings rose 12%, totalling €87bn ($104bn), he said in Rome on the sidelines of a southern European summit on migration.
In 2016, Spain welcomed 75.3 million visitors, just behind the United States with 75.6 million, while France -- despite its own terror woes -- easily remained the world leader with 82.6 million visitors, according to the UN World Tourism Organisation (UNWTO).
International tourism to the United States shrank during the first five months of Donald Trump's presidency, according to the US International Trade Administration.
Arrivals fell 5% in the first quarter and 3% in the second quarter, official figures show. 
Rajoy praised the Spanish tourism sector's "great effort" to become more competitive.
Arrivals in Spain beat records for the fifth consecutive year, despite jihadist attacks in the Catalonia capital Barcelona and nearby Cambrils last August that left 16 dead.
Catalonia also remains in the grip of a secession crisis.
Arrivals recovered after dropping off by 5% year-on-year in October as massive demonstrations were staged following a failed independence bid.
The Madrid-based UNWTO is set to release its figures for 2017 on Monday.
The French foreign ministry said in December it estimated 2017 arrivals at upwards of 89 million.
Related Story