"There is no valid information yet on the motive" of the man, who "entered a supermarket and suddenly began attacking customers", said police.
German daily Bild published a picture of the attacker in the back of a police car with a white, blood-soaked bag over his head, and reported that he cried "Allahu Akbar" (God is Greatest) in the supermarket.
This account was not immediately confirmed by police.
The suspect, who has not yet been identified, fled the supermarket after the attack.
More From This Section
"It was definitely a sole attacker. The first reports about a possible motive of a robbery have not been confirmed," Hamburg police tweeted.
Police have blocked off the area, in the northeast of the port city, Germany's second largest and host of the G20 summit of world leaders in early July.
Anti-terror police have also been deployed to the scene, according to Bild.
Germany has been on high alert about the threat of a jihadist attack, especially since last December's truck rampage through a Berlin Christmas market that claimed 12 lives.
It was Germany's deadliest attack by Islamic militants, but not the first.
In 2016, the IS group also claimed a bomb attack in the southern city of Ansbach which wounded 15 people and killed the Syrian attacker, and an Afghan man's axe rampage on a train in Bavaria that wounded five, before the perpetrator was shot dead by police.
In both of these cases, the attackers had been asylum seekers. But prosecutors think they were radicalised in Germany and not deployed from abroad to commit the attacks, like the jihadists behind the November 2015 Paris attacks were.
Public fears about more extremist violence have grown amid Germany's mass influx of refugees and migrants, mostly from Syria, Iraq, Afghanistan as well as several African countries.
Chancellor Angela Merkel opened Germany's borders in 2015, bringing more than one million asylum seekers to Germany since.
Germany is a target for jihadist groups, particularly because of its reconnaissance and refuelling missions to support the coalition fighting IS in Iraq and Syria, and because it has deployed troops in Afghanistan since 2001.