The stabbing process in Kawasaki, the southern suburb of the capital, resulted in two dead, a child and the attacker, AFP reported.
The authorities said earlier that the attack killed 19 people, including a girl and a man who "show no vital signs", a popular phrase in Japan that means the person is dead but his death was not confirmed by a responsible medical reference.
This is a rare attack in a country known for its low crime rate, coinciding with a visit by US President Donald Trump to Japan.
Trump said in response to the attack that Americans "stand with the people of Japan."
He said during his visit to a Japanese military vessel that he offered "prayers and sympathy to the victims," stressing that "all Americans stand with the people of Japan and grieve for the victims and their families."
The attack took place in the morning rush as the staff went to work and students went to school.
Fire brigade spokesman Yuji Sikizawa said most of the 17 injured were children.
Local television footage showed a number of police cars, ambulances and firefighters at the scene of the attack, while medical crews set up tents in the area to treat the wounded.
Japan has one of the lowest crime rates in the developed world, and mass attacks are extremely rare in the archipelago.
In 2018, a man was arrested in central Japan after stabbing one person to death and wounding two others on a high-speed train in an attack that led to new security measures on the famous rail service.
In 2016, a man stabbed 19 people in Tokyo in an attack he said it was committed to "rid the world of people with mental illness."