Chancellor Angela Merkel said there were many signs the attacker in Hanau had acted out of racism.
Federal prosecutors are treating the case as terrorism. Turkey says at least five of the dead were Turkish citizens.
The 43-year-old suspect killed himself, police say. He was found dead at his home along with the body of his mother.
Local media have identified the suspect as Tobias R, a German citizen. The Bild tabloid reports he had a firearms licence, and that ammunition and gun magazines were found in his car.
Authorities are examining a video that appears to be from the suspect, posted online days before the attacks, in which he expresses right-wing conspiracy theories. German media say he also left a letter of confession.
The attack comes amid growing concerns about far-right violence in Germany. Speaking in Berlin, Mrs Merkel said: “Racism is a poison. Hate is a poison and this poison exists in our society and is already to blame for many crimes.”
What do we know about the attacks?
The shootings took place around 22:00 (21:00 GMT) on Wednesday, and the first target was the Midnight shisha bar in the city centre of Hanau. Witnesses reported hearing about a dozen gunshots.
The suspect then travelled in a dark car to the Kesselstadt neighbourhood, some 2.5km (1.5 mile) away, and opened fire at the Arena Bar & Cafe.
Shisha bars are places where people gather to smoke a pipe known as shisha or hookah. Traditionally found in Middle Eastern and Asian countries, they are also popular in many other parts of the world.
Turkey’s President Recep Tayyip Erdogan said he expected the German government to make “necessary efforts to throw light on all aspects” of the attack.
The shootings sparked an hours-long manhunt through the night while officers, supported by helicopters, searched for what they thought could have been more than one attacker.
Police identified the gunman through information from witnesses and surveillance cameras. Early on Thursday, they stormed the suspect’s home, near the scene of the second shooting, and found him dead near his 72-year-old mother.
Can-Luca Frisenna, whose father and brother run one of the two bars attacked, told Reuters news agency: “I heard my father was affected and my little brother… I saw them both – they were horrified and they were crying and everything. So everyone was shocked.”
Hanau, in Hesse state, is a city of 100,000 residents about 25km east of Frankfurt.
What do we know about the suspect?
Hesse Interior Minister Peter Beuth said authorities were also examining a website attributed to the suspect. “What we know so far is that there is definitely a xenophobic motive. Whether there are claims of responsibility or documents, that’s still being investigated,” he said.
The suspect was not known to the authorities, Mr Beuth added.
In a brief statement, Mrs Merkel also vowed to do everything possible to clarify the background to the attack, saying: “There are many indications at the moment that the perpetrator acted on right-wing extremist, racist motives, out of hatred towards people of other origins, religion or appearance.”
Gun laws in Germany are among the most stringent in the world, and were tightened further in recent years after other mass shootings.