The out-of-service train derailed after smashing into a maintenance carriage left lying on the line between the Japanese capital and Kawasaki, a nearby city.
The collision took place at around one o'clock in the morning at the station in Kawasaki, a satellite city south of Tokyo, after the last train on the Tokyo-Yokohama commuter line had passed, officials said.
The first and second cars of the 10-car train derailed on impact, trapping the only two men on board, but they were rescued later by firefighters who broke into the train by smashing windows, railway officials said.
The Kawasaki station had been undergoing night-time renovation works.