A 17-year-old Afghan refugee severely wounded four passengers before police shot him dead late on Monday.
DAESH claimed responsibility on Tuesday for the attack by the axe-wielding Afghan refugee on a German train, according to its online Amaq news agency.
"The perpetrator of the stabbing attack in Germany was one of the fighters of DAESH and carried out the operation in answer to the calls to target the countries of the coalition fighting DAESH," the statement said.
Speaking to media, Interior Minister Joachim Herrmann said that the attacker was believed to have been living in a home for unaccompanied minors in Ochsenfurt, near the city of Wuerzburg.
— Samir Saati (@samsaati) July 18, 2016
A hand drawn DAESH flag was found in the refugee's room.
The attack comes just days after a Tunisian delivery man plowed a 19-tonne truck into crowds of Bastille Day revellers in the southern French city of Nice, killing 84.
"The attacker appears to have been a 17-year-old Afghan who has been living in Ochsenfurt for some time," Herrmann said.
"He suddenly attacked passengers with a knife and an axe, critically injuring several. Some of them may now be fighting for their lives. Two of those injured in the attacks were in a critical condition and several of the injured included members of a Chinese family."
He said the attacker had come to Germany as an unaccompanied minor about two years ago.
The case is likely to deepen worries about so-called 'lone wolf' attacks in Europe and could put political pressure on German Chancellor Angela Merkel, who welcomed hundreds of thousands of refugees to Germany over the past year.
At least one witness reported that the attacker, had shouted "Allahu Akbar" (God is greatest), Herrmann said.
"All of that has to be put together in a large mosaic as to what his motivations were. We are pursuing every piece of evidence."
The teenager fled after the emergency brake was pulled and was pursued by a police unit and shot dead when he tried to attack the officers, officials said.
Chinese media reported that the injured passengers were from Hong Kong.
Unlike neighbours France and Belgium, Germany has not been the victim of a major attack by DAESH in recent years, although security officials say they have thwarted a large number of plots.
Germany welcomed over 1 million refugees in 2015, of which many were fleeing war in countries like Syria, Iraq and Afghanistan.