Spanish authorities say that a key suspect in the Barcelona terror attack was one of five men killed by police during a second incident in the town of Cambrils.

Police had earlier said they were searching for Moussa Oukabir after the shocking ramming attack on the popular Las Ramblas district on Thursday (17 August).

The attack left 13 people dead and dozens injured with the driver of the van escaping on foot.

Hours after the white van ploughed through pedestrians another ram attack took place in a seaside town south of the city.

At around 1am the following morning, five alleged terrorists were shot dead in Cambrils after they killed one and injured five civilians and one police officer.

Spanish media reported that one officer from the Catalonia police force Mossos d'Esquadra, shot dead four of the men after they drove a black Audi into crowds of people.

It was reported that the men were wearing fake explosive vests at the time and were armed with guns, machetes and axes.

Later in the day it was announced that Oukabir, thought to be 17, and a Spanish citizen from the northern Catalan city of Girona, was killed by police in Cambrils.

Barcelona attack
Spanish police identified Moussa Oukabir as the main suspect in the Barcelona attack Twitter

Spanish police had said that they were searching for three suspects with most of the other suspects being Moroccan and one remaining unaccounted for.

Four suspects have been arrested including Oukabir's brother, Driss, who handed himself into police. It is believed that Moussa may have used his brother's documents to rent the white van used in the Barcelona attack.

A street is cordoned off after a van crashed into pedestrians near the Las Ramblas avenue in central Barcelona REUTERS/Stringer

Police say the suspects had been planning more sophisticated attacks. A blast on Wednesday in Alcanar, a town south of Barcelona, which was originally thought to be due to a gas leak may have actually deprived plotters of bomb-making materials.

Police official Josep Lluis Trapero said the blast was related to the Barcelona attack and that those in the house were attempting to "prepare an explosive device".

barca suspects
Moussa Oukabir, 17, Said Aallaa, 18, and Mohamed Hychami, 24, who are believed to be dead while Younes Abouyaaqoub, 22, is still unaccounted for. Police handout

Authorities have told the media that Said Aallaa, 18, and Mohamed Hychami, 24, and Oukabir, were among the dead while a fourth suspect, Younes Abouyaaqoub, 22, was still unaccounted for.

Islamic extremist group Isis have claimed responsibility for the attacks via their Amaq News Agency.