Younes Abouyaaqoub, 22, was the suspected driver of a van that mowed down crowds in Barcelona, killing 14 people.
He was wearing a suspected explosives belt which officers removed after shooting him.
Spanish police had previously declined to confirm media reports of his death, but said on Twitter shortly before that an “incident” was under way in Subirats, 10 km (6 miles) away.
The daughter of a Catalan vineyard owner told local media her father had alerted police after they saw a car crossing their property at high speed even though the vineyard was closed off.
In a tweet, police in Catalonia had said they knew who the driver was without naming him, but regional interior minister Joaquim Forn had said in a radio interview that “everything suggests the van driver is Younes Abouyaaqoub.”
The 22-year-old Moroccan is believed to be the last remaining member of a 12-person cell still at large in Spain or abroad, with the others killed by police or detained over last week’s twin attacks in Barcelona and the seaside resort of Cambrils.
Investigators have honed in on an imam, Abdelbaki Es Satty, aged in his 40s, who is among the suspects and is believed to have radicalized youths in Ripoll, a small town at the foot of the Pyrenees.
Several suspects — including Abouyaaqoub — grew up or lived there.
Police raided more homes there on Monday morning, Forn said.
Police said the imam had spent time in prison and had once been in contact with a suspect wanted on terrorism charges, without giving further details.
El Mundo newspaper reported that Satty had struck up a friendship in prison with Rachid Aglif, who is serving an 18-year sentence over the 2004 Madrid train bomb attacks, which killed 191 people.
Prosecutors in Belgium also said he had spent time in the country, without elaborating.
The imam has been missing since Tuesday. On Saturday, police raided his apartment. They have raised the possibility that he died in an explosion on Wednesday evening at a house believed to be the suspects’ bomb-making factory, where police uncovered a cache of 120 gas canisters.
The suspected jihadists had been preparing bombs for “one or more attacks in Barcelona,” regional police chief Josep Lluis Trapero told reporters, revealing that traces of triacetone triperoxide (TATP) — a homemade explosive that is a hallmark of the Daesh group — had also been found.
The suspects accidentally caused an explosion at the house on the eve of Thursday’s attack in Barcelona — an error that likely forced them to modify their plans.
Instead, they used a vehicle to smash into crowds on Barcelona’s Las Ramblas boulevard as it was thronged with tourists, killing 13 people and injuring about 100.
Several hours later, a similar attack in the seaside town of Cambrils left one woman dead. Police shot and killed the five attackers in Cambrils, some of whom were wearing fake explosive belts and carrying knives.
Daesh claimed responsibility for the attacks, believed to be its first in Spain.
In the small town of Alcanar, investigators combed the rubble of the house believed to be the suspects’ bomb factory, where the gas canisters were uncovered.
A neighbor, 61-year-old French retiree Martine Groby, told AFP that four men “who all speak French” had been in the house next door since April.
“They were very discreet, too discreet. The shutters were closed, there was no music, no children, no women,” she recalled.
Most of the suspects are children of Moroccan immigrants, including Ripoll-born Moussa Oukabir, 17, one of five suspects shot dead in Cambrils. His older brother Driss is among the four arrested.
A cousin said Moussa “loved playing football, having a good time, chatting up girls.”
“The last few months, he started to become interested in religion. He used to go to a mosque in Ripoll. Maybe that’s where he was brainwashed,” the cousin said.
Three days after the attack that plunged the country into deep grief, locals and tourists turned out in force on Sunday at Barcelona’s Sagrada Familia basilica.
King Felipe, Prime Minister Mariano Rajoy and Catalonia’s president, Carles Puigdemont, led a 90-minute ceremony commemorating the victims, who came from three dozen countries, some as far afield as Australia, China and Peru.
In the evening, local football heroes FC Barcelona staged a minute’s silence at the 99,000-capacity Camp Nou stadium for their first game of the league season.
Barcelona stars including five-time World Player of the Year Lionel Messi wore shirts with “Barcelona” replacing individual names on the back, while their opponents Real Betis carried the message “Real Betis with Barcelona” on theirs.
The list of individual tragedies lengthened as a seven-year-old British-Australian boy, Julian Cadman, who had been named as missing, was confirmed as being among the dead.
“He was so energetic, funny and cheeky, always bringing a smile to our faces,” his family said.
“We are so blessed to have had him in our lives and will remember his smiles and hold his memory dear to our hearts.”