BARCELONA, Spain - Hours after a terror attack in Barcelona left at least 13 people dead, Spanish police said officers shot and killed five people in a different town who were plotting a separate attack.
The suspects in the Spanish resort town Cambrils were carrying bomb belts and had run over civilians with a car, police said.
The seaside town is about 62 miles south of Barcelona. The Catalan government said the Cambrils attack was linked to the vehicle attack on a popular Barcelona promenade that killed 13 people.
The region's Interior Minister Joaquin Forn told local radio RAC1 early Friday that the Cambrils attack "follows the same trail. There is a connection."
He did not explain what connected the attacks. He confirmed the driver in the Barcelona attack remains at large.
Police earlier said two people who have been arrested were not the driver.
The Cambrils attack involved five suspects who carried bomb belts. Police shot and killed the suspects and detonated their explosives.
Police have given no details on the attack in Cambrils, but media reports say a vehicle hit a police car and people nearby. Six were hurt.
In the Barcelona attack, two people were arrested after a van plowed into a crowd in the Las Ramblas district, killing 13 people and leaving 100 others hospitalized, officials say.
Catalan police confirmed the arrest of one person and said they were treating the suspect as "a terrorist." About an hour later, Catalonia's regional president said a second arrest was made.
A senior police official said the van attack was "clearly a terror attack" that was "intended to kill as many people as possible."
Interior Department chief Joaquim Forn said the death toll could increase since at least 15 of the 100 people thought to have been injured in the attack were hurt badly.
The suspects' identities were not immediately released. A police official described the two detained suspects as a Spanish national from Melilla and a Moroccan, and that neither was the driver of the van. The driver is believed to still be on the loose.
A police official also said the van attack is linked to an explosion that occurred the previous day in which one person was killed. No further details were released about that previous incident.
Hours after the van crash occurred, ISIS claimed responsibility for the attack. A statement carried by the extremist group's media arm - the Aamaq news agency - said Thursday's attack was carried out by "soldiers of the Islamic State."
It says the attack was in response to ISIS' calls for its followers to target countries participating in the coalition trying to drive the extremist group from Syria and Iraq. The statement provided no further details about the attackers.
See video from the scene here:
Scene in Barcelona after van hits pedestrians
The attack left people sprawled out on the ground in the city in northeastern Spain, some spattered with blood, others with broken limbs.
An eyewitness told a Spanish TV station that the suspect was running people over in a van for nearly 1,000 feet before fleeing into a nearby Turkish restaurant.
The witness said the suspect had something in his hand but he could not tell what it was.
Police denied earlier media reports that officers had a suspect surrounded in a bar near the crash site. They confirmed no one was held up.
A spokesperson for the Spanish Guardia Civil told ABC News that the name of the man who rented a van used in the Barcelona attack is Driss Oukabir, but it has not been confirmed whether he was involved in the crash or was one of the suspects arrested.
In a photograph on public broadcaster RTVE, three people were lying on the ground in the street of the northern Spanish city Thursday afternoon, apparently being helped by police. Other videos showed five people down and recorded people screaming as they fled the scene.
PHOTOS: Photos from the scene of Barcelona incident
Hours after Thursday's attack, the police force for Spain's northeastern Catalonia region said that troopers searching for the perpetrators shot and killed a man who was in a car that hit two officers at a traffic blockade on the outskirts of Barcelona. But Trapero said it was not linked to the van attack.
Police cordoned off the broad, popular Barcelona street, ordering stores and nearby Metro and train stations to close. Authorities asked people to stay away from the area so they do not get in the way of emergency services. A helicopter hovered over the scene.
President Donald Trump condemned the attack and said in a statement on Twitter that the U.S. will do "whatever is necessary to help."
Speaking to reporters at the State Department shortly after the attack, U.S. Secretary of State Rex Tillerson offered assistance to authorities in Spain.
U.S. Secretary of State Rex Tillerson offers assistance to Barcelona
He said U.S. diplomats are currently assisting Americans in Spain and asked those who are safe to notify friends and families. He added "terrorists around the world should know that the United States and our allies are resolved to find you and bring you to justice."
Spanish Prime Minister Mariano Rajoy says his country is mourning in solidarity with Barcelona and other cities in Europe that have been hit by deadly extremist attacks.
Rajoy traveled to Barcelona following the attack. He said the victims and their family and friends "are in this moment our main priority."
The capital of Spain's Catalonia region was "today hit by jihad terrorism like other cities have been throughout the world."
The prime minister said the residents of Paris, Nice, Brussels, Berlin and London "have experienced the same pain and uncertainty that those of Barcelona suffer today."
For Spain, Thursday's bloodshed was the country's deadliest attack since 2004, when al-Qaida-inspired bombers killed 192 people in coordinated assaults on Madrid's commuter trains.
Rajoy declared three days of mourning across Spain.
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.
Cars, trucks and vans have been the weapon of choice in multiple extremist attacks in Europe in the last year.
The most deadly was the driver of a tractor-trailer who targeted Bastille Day revelers in the southern French city of Nice in July 2016, killing 86 people. In December 2016, 12 people died after a driver used a hijacked truck to drive into a Christmas market in Berlin.
There have been multiple attacks this year in London, where a a man in a rented SUV plowed into pedestrians on Westminster Bridge, killing four people before he ran onto the grounds of Parliament and stabbed an unarmed police officer to death in March and four men drove onto the sidewalk of London Bridge and rampaged with knives nearby, killing eight in June.
A man also drove into pedestrians leaving a London mosque later in June.
ABC News and the Associated Press contributed to this report.