Spanish police said they have killed five “perpetuators of a terrorist attack” and injured one person in the town of Cambrils, a coast town south of Barcelona.
An eyewitness published a video of shots being fired in the seaside town and multiple police vans in the background.
Local media has said that attackers had tried to replicate the Barcelona van attack by driving into people in the eary hours of Friday morning.
Officials had warned people to stay inside while police launched an operation in the area. They have now confirmed the situation is under control.
It is not known whether its connected to the attack in Barcelona, in which 13 people died and dozens more were injured when a van drove at crowds in the bustling La Ramblas area of the city on Thursday afternoon.
Police are still looking for the driver of the van, while two arrests have been made.
The vehicle drove at speed through the boulevard mowing down pedestrians in what Spain's prime minister has described as "jihadi terrorism".
Police confirmed in a press conference on Thursday evening that more than 100 people were injured following the incident. At least 15 of those injured are thought to be in a critical condition and the death toll is expected to rise.
ISIL have claimed responsiblity for the attack, which targeted a boulevard popular with tourists in the height of the summer.
Belgium's deputy Prime Minister confirmed on Twitter that a Belgian national was one of the victims killed in the attack.
The driver of the vehicle fled the scene on foot, and police have instituted a manhunt for him, calling the attack a terrorist incident.
Police have released an image of a man alleged to have rented the van. He has been named as Driss Oubakir, reported to have been born in Morocco by local media.
Catalan police have also said that hours after the attack a driver struck two officers at a checkpoint. Although it is not known whether it is related to the van attack.
Local media are reporting that a suspect was killed during a shoot-out with police.
Police said that an explosion at a house outside Barcelona on Wednesday in which one person died was connected with the attack.
Gunfire was heard in the area round La Boqueria market as of 4.50pm local time, according to media.
It was suggested earlier on on Thursday that two men had entered a restaurant in the city and were appeared to be set upon remaining in a siege situation - police later denied these reports.
Witnesses speaking about the first incident described the chaos that ensued after the event.
Videos have circulated on social media showing many of the injured lying across the street as passersby rush to their aid. Police have urged social media users not to share graphic images from the scene.
Lindsay Davidson told Sky News: “We were in a changing room in a shop and saw loads of people running out the door, and we waited a few minutes to see what it was, then we came out the door and there were police everywhere. We didn’t see any victims, everyone was just running to escape the scene.
“All the shops are now shut, and all the cafes are closed tonight”.
Eyewitness Susan McLean told the channel that it was “quite terrifying, all of sudden people ran screaming towards us, everyone hysterical. It calmed down for a moment than a second wave of people came down the street and we just ran. The police were doing their job but we had no idea what was going on.”
A photograph shown by public broadcaster RTVE, showed three people lying on the ground in the street apparently being helped by police and others.
Police cordoned off the broad, popular street, ordering stores and nearby Metro and train stations to close. They asked people to stay away from the area so as not to get in the way of emergency services. A helicopter hovered over the scene.
Las Ramblas, a street of stalls and shops that cuts through the center of Barcelona, is one of the city's top tourist destinations. People walk down a wide, pedestrianized path in the center of the street, but cars can travel on either side.
The boulevard is one of Barcelona's busiest streets, normally thronged with tourists and street performers until well into the night.
ISIL said one of their "soldiers" committed the attack via its own news agency, although it has offered no proof of this.
International politicians and heads of state have condemned the attack, sending messages of condolence to those caught up in the incident.
The use of vehicles to attack civilians has become an increasingly popular option for terror groups in recent years. More than 80 people died in Nice on July 14, 2016, when Mohamed Lahouaiej-Bouhlel ploughed through crowds of people celebrating Bastille Day in the southern French city.
And in June this year, a van driven at pedestrians on London Bridge resulted in eight deaths when they mowed down dozens of people out on a Saturday night in the British capital.