The incident happened amidst party-goers who were heading into the city centre for Halloween gatherings.
The 24-year-old attacker was arrested on the spot by police.
According to local media, the attacker had also spread fluid around the train and started a fire.
One video uploaded on Twitter and broadcast on NHK showed a steady stream of people running away from a train car where, seconds later, a small explosion caused a fire. Another video showed passengers rushing to squeeze out of the train's windows and onto the platform where the train had made an emergency stop.
"I thought it was a Halloween stunt," one witness told the Yomiuri newspaper, recalling the moment he saw other passengers running in a panic towards his train car. "Then, I saw a man walking this way, slowly waving a long knife." He said there was blood on the knife.
The attack reportedly occurred on the Keio express line bound for Shinjuku which is the world's busiest train station.