The 17-year-old injured four people from Hong Kong, one critically, in the attack in Wuerzburg on Monday evening. He was shot dead by police as he fled.
He had shouted Allahu akbar" ("God is great"), a witness said.
The IS-linked Amaq news agency said the teenager was an IS "fighter".
It said he had "carried out the operation in answer to the calls to target the countries of the coalition fighting the Islamic State".
The attack comes days after a lorry ploughed into a crowd in Nice in France, killing 84 people. The self-styled Islamic State group said one of its followers had carried out that attack.