The UK said it would impose restrictions on all holidaymakers returning from Spain after 11pm on Saturday.
Anyone returning from Spain would have to self-isolate for 14 days, the government confirmed to UK media.
The move comes only two weeks after Spain was included in a list of “safe countries” from which returning UK holidaymakers were exempt from the quarantine rule.
The UK government said public health was an “absolute priority”.
“We have taken this decision to limit any potential spread to the UK. We've always been clear that we would act immediately to remove a country where necessary,” a spokesman from the Department for Transport told the BBC.
The government said people currently on holiday in Spain should follow the local rules, return home as normal, and check the Foreign Office's travel advice website for further information.
“The Joint Biosecurity Centre together with Public Health England have updated their coronavirus assessments of Spain based on the latest data,” said a British government spokesman.
“As a result, Spain has been removed from the lists of countries from which passengers arriving in England, Scotland, Wales and Northern Ireland are exempted from the need to self-isolate.”
The surprise move comes after a rise in cases in recent days, especially in the region of Catalonia, which stepped up curbs on Saturday by closing all nightclubs for 14 days.
The order, which will come into effect on Saturday and remain in force for two weeks, was given as Spain watches more than 280 new outbreaks, with virus cases tripling in the past fortnight.
Nearly half of all new cases have been in Catalonia, where just a week ago, officials urged nearly four million residents of metropolitan Barcelona to stay home unless absolutely necessary.
However not everywhere in Spain had seen a surge in cases with the tourism hub around Costa del Sol not reporting worrying rises.
UK tourists have been told they would avoid the two-week quarantine rule if they made it back to the UK before 11pm on Saturday evening.
The UK government also said it was advising its citizens against all non-essential travel to mainland Spain. While it confirmed it was not advising against travel to either the Balearic Islands (Mallorca, Minorca, Ibiza) or the Canary Islands UK visitors to those areas would still need to abide by the quarantine on return.
Some health officials have been suggested Spain could already be at the beginning of a second wave.
Maria José Sierra, the deputy head of Spain's health emergencies said that while the curve had been flattened “community transmission was being seen in north-eastern areas.”
“It could already be a second wave, but that's not the most important thing,” Sierra told reporters. “The most important thing is that we keep following what's going on, see what measures are necessary and take them early.”
But in an interview with CNN on Friday, the foreign minister, Arancha González Laya, said Spain was one of the countries with the “most controls and mechanisms for identifying outbreaks”.
She dismissed suggestions of a second wave of Covid-19. “We’re not worried; we’re identifying cases and isolating them to cut off transmission,” she said.
“As long as we don’t have a vaccine or a treatment, this is what the new normality will be like. We ask citizens to comply with the restrictions and behave in a responsible manner. There isn’t a second outbreak but there are one-off outbreaks.”
France has also been worriedly watching the situation in Catalonia, with Prime Minister Jean Castex on Friday urging French nationals “to avoid going there until the health situation improves”.