A 26-year-old man has gone on a stabbing spree with a kitchen knife in the northern German city of Hamburg, killing a 50-year-old man and wounding six others, police say.

Passers-by tackled the attacker as he fled the scene, enabling plain clothes police officers to take him into custody, the police said.

Video filmed by a motorist appears to show a group of men armed with chairs confronting the 26-year-old.

Another video, taken by a witness, shows the same man lying face down on the pavement, wearing handcuffs and surrounded by police officers.

Police said the man, who was born in the United Arab Emirates, suddenly began attacking customers in a supermarket.

An elderly woman is accompanied by a firefighter after a knife attack at a supermarket in Hamburg, Germany, 28 July 2017. (AFP)

A police spokeswoman said she could not confirm a report by a female witness on television that the attacker shouted "Allahu Akbar", Arabic for "God is greatest", as he ran out of the supermarket.

She said the motive for the attack was still under investigation. Police said the man was born in the UAE but said they were still trying to determine his citizenship.

The spokeswoman also said she had no information that the attacker was known to authorities as an Islamist, as reported by German newspaper Tagesspiegel.

In an updated statement late on Friday police said a 50-year-old woman and four men aged between 19 and 64 sustained injuries in the attack. A 35-year-old man was injured while trying to stop the attacker, they said.

"It was definitely a lone attacker," Hamburg police said in a tweet. They said initial reports about a possible robbery had not been substantiated.

Police have been on high alert in Germany since a spate of attacks on civilians last year, including a December attack on a Berlin Christmas market, when a hijacked truck ploughed into the crowds, killing 12 and injuring many more.

Security has been a campaign issue ahead of September 24 parliamentary elections, in which Chancellor Angela Merkel is expected to win a fourth term in office.

Newspaper Bild showed a picture of the alleged Hamburg attacker sitting in the back of a police car, his face concealed with a bloodied shroud.