A POLICE officer shot dead a man armed with a knife as he tried to attack a police station in the northern Spanish region of Catalonia on Monday, in what police are treating as a “terrorist attack”.

It comes as Spanish authorities said another incident in Zaragoza where a car mounted a footpath, injuring three people, was being treated as a “traffic accident”.

Police said the man invoked the name of Allah during the knife assault, which came just days after the first anniversary of a twin attack in Catalonia that killed 16 people.

The man arrived at the closed police station in the town of Cornella de Llobregat near Barcelona at 5.45am (1.45pm AEST) and repeatedly pressed the buzzer to be let in, Rafel Comes, a commissioner with the Catalan regional police, told a press conference.

After police allowed him in, the man pulled out a “large knife” and lunged at officers in “a clearly premeditated desire to kill an agent of our force,” Mr Comes said.

“The officer used her gun to save her own life,” Mr Comes said, adding that “we are treating it as a terrorist attack”.

The man shouted “Allahu Akbar” (God is great) as well as words the police officers did not understand, Mr Comes said.

Anti-terrorism police sources had earlier told AFP the man was a 29-year-old Algerian, but Comes said police still needed to confirm that the Algerian identity papers he carried with him were in fact act his.

Police searched the man’s home, which was located just a few hundred metres from the site of the attack.

Resident Conchi Garcia, a 50-year-old office worker, said the man suspected in the attack came to the neighbourhood two years ago, moving in with a single mother who had always lived in the area.

“She started wearing the veil overnight. It was strange,” Ms Garcia told AFPTV.

Another neighbour, who would only give her first name, Mary, said police “monitored the couple’s movements closely”.

Security has been reinforced at police stations across Catalonia.

It comes as a speeding car mounted a pavement and ploughed into pedestrians in Spain today, according to reports.

At least three people — including a 45-year-old man and an older couple — were injured in the crash, police said.

A spokeswoman for a civil protection agency confirmed the victims had been taken to hospital but said no further details of their injuries had been given.

A manhunt had earlier been launched after the driver, who did not stop after mowing down the pedestrians, sped off in the opposite direction.

The car was later found abandoned in a street just 200 yards away from Bar Avenida.

The vehicle smashed into people close to a pedestrian crossing outside Bar Avenida in Zaragoza at around 9.30am local time.

The driver sped along the footpath at 65km for about 40 metres before fleeing the scene in the capital of northeastern Spain’s Aragon region, local media reports say.

According to Aragon TV, two people — a man and a woman — have been arrested.

Police are said to be treating the crash as a “traffic accident”.

The incidents occurred just days after the one-year anniversary of a deadly jihadist rampage in Catalonia.

Sixteen people were killed on August 17 and 18, 2017 when a van drove into crowds on Barcelona’s popular Las Ramblas boulevard and in a knife attack in the nearby resort of Cambrils.

The Islamic State group claimed responsibility for the attacks, Spain’s worst since the Madrid train bombings in 2004 when 191 people died and more than 1800 were injured.

Spain has kept its terrorist alert at the second-highest level since 2015.