The suspect was arrested after the train stopped in Arras, 115 miles (185 kilometers north of Paris, Interior Ministry spokesman Pierre-Henri Brandet said on French television BFM. Passengers were evacuated and police have secured the area.
Investigators from France's special anti-terror police are leading the investigation, a spokeswoman for the Paris prosecutor's office said.
Two of the victims were in critical condition, according to a statement from the office of President Francois Hollande.
The suspect is a 26-year-old Moroccan, said Sliman Hamzi, an official with police union Alliance, said on French television i-Tele.
Christophe Piednoel, a spokesman for national railway operator SNCF, said the suspect was armed with an automatic rifle and a knife.
France's interior minister Bernard Cazeneuve was en route to Arras.