Authorities were quick to allay fears, saying there was no indication an attack was in the works, but Spain has nevertheless strengthened security during the holiday season.
Madrid for one has taken unprecedented measures that include using bollards and police vans on roads near the famous Puerta del Sol square where Spaniards gather for New Year's Eve, to guard against truck attacks like those that hit Nice and Berlin.
Trucks have also been banned next week from parts of the city where people gather to watch traditional parades celebrating the arrival of the wise men after Jesus was born.
Police arrested two alleged jihadists on Wednesday and said they found bullets and empty weapons magazines for “long guns” when they raided a hut in a Madrid park that Edrissa Ceesay and Samir Sennouni used to go to.
They also found a memory card at Ceesay's home with videos showing them and others holding an AK-47 assault rifle and machete, a court document said.
The videos also had “Daesh (Islamic State group) attributes including their flag, with Islamic chants and jihadist-style phrases,” it added.
They published these on Instagram, Facebook and YouTube, according to the document.
A judicial source who refused to be named added there were “images showing men with hoods, weapons, in front of the Puerta del Sol.”
But on Thursday, Interior Minister Juan Ignacio Zoido told reporters there was “no concrete evidence that makes us think there was going to be an attack in Spain”.
Ceesay and Sennouni, both Spaniards, have been remanded in custody. According to authorities, 177 alleged jihadists have been detained since 2015, when Spain increased its terror alert to category four on a five-point scale.
Spain has been mentioned on extremist websites as a possible attack target for historical reasons, given much of its territory was under Muslim rule from 711 to 1492.
But unlike France or Belgium, the country is less exposed to the risk of returning radicalised nationals who went to fight abroad and plan to commit extremist acts on home soil.
Only around 200 Spaniards are estimated to have gone abroad to fight, compared to thousands from nearby France and Belgium.