Police have shot dead the main suspect in last Thursday's Barcelona attack, Younes Abouyaaqoub.
They believe he was the driver of a van which careered down the Las Ramblas avenue, killing 13 and injuring more than 100 others.
He was killed some 25 miles (40km) west of Barcelona near a sewage treatment works following a tip off.
Abouyaaqoub, wearing a fake explosive belt, is reported to have shouted "Allahu Akbar" ("God is Greatest").
An extensive manhunt was already under way when police closed in on the Subirats area, close to Sant Sadurní d'Anoia.
A petrol station employee spotted Abouyaaqoub and called the police who found him hiding in vineyards.
After he was shot, bomb disposal officers used a robot to examine the fake explosive belt. This led to some delay before Moroccan-born Abouyaaqoub could be officially identified.
Local residents described seeing some 20 police cars heading for the scene and helicopters circling.
Police said the investigation was still international in scope.
At an earlier news conference, police described Abouyaaqoub's escape from the scene of the Barcelona attack on foot to the outskirts of the city where he hijacked a car and stabbed its driver.
CCTV footage in Spanish media appears to show him walking through a market district.
The man murdered in the car was named as Pau Pérez, 34, from Vilafranca - the 15th victim of the Barcelona bloodshed and a later attack in the resort of Cambrils.
A woman died in Cambrils when a car was driven into pedestrians and five suspected jihadists were killed at the scene by police early on Friday.
Police have also confirmed that an imam, suspected of radicalising the young men who carried out the attacks, died in what is believed to have been an accidental explosion on Wednesday at a house in Alcanar, south of Barcelona, that was being used as a bomb factory.
The remains of one other person found at the house are still being examined.
The terror cell behind the attacks was 12 strong. Police say eight suspects are now dead and four are in custody.
The group had apparently been planning three co-ordinated attacks using home-made bombs, but were thwarted by the Alcanar blast. Police found about 120 gas canisters at the Alcanar site.
Family members of the dead suspects said they believed Imam Es Satty had radicalised several young people in their home town of Ripoll, north of Barcelona.
Spanish media outlets say he had spent some time in prison, and had met prisoners involved or linked with the 2004 Madrid train bombings in which 191 people died.
He had also stayed in Belgium for some three months last year, where he had been searching for work, including in Vilvoorde, a small town of 42,000 people from which more than 20 jihadists departed for Syria in 2014.
An official who works on de-radicalisation in Belgium has told the BBC that Es Satty tried to secure a post at a mosque near Brussels but the elders decided he should not be allowed to preach due to his "radicalised and polarising" approach.
The mosque asked police to perform a background security check but this did not throw up any specific areas of concern.
Catalan officials said that all 15 victims had now been identified and their families notified.
The Ripoll cell
- Shot dead west of Barcelona: Younes Abouyaaqoub, 22, presumed driver of van on Las Ramblas
- Shot dead in Cambrils: Said Aallaa, 18, Moussa Oukabir, 18, Houssaine Abouyaaqoub, 19, (brother of Younes), Omar Hychami, 21 and Mohamed Hychami, 24
- Arrested: Driss Oukabir, 28, (brother of Moussa), Mohamed Houli Chemlal, Salah al-Karib, 34, and Mohammed Aallaa, 27
- Human remains found at Alcanar explosion site: Abdelbaki Es Satty, Rupoll imam said to have inspired the cell; Youssef Aallaa, presumed but not confirmed (brother of Said Aallaa)
So-called Islamic State (IS) said it had carried out the Las Ramblas and Cambrils attacks, though it is not clear whether any of the attackers were directly connected to the group or simply inspired by it.