"The train accident was caused by a homemade explosive device," Sergei Bednichenko, chief prosecutor for Russia's North West district, told Channel One television. "A criminal case has been opened under article 205, clause 3, that is terrorism."
There was no indication of who may have planted the bomb. Groups linked to an insurgency in Russia's Chechnya region have carried out violent attacks in the past but they have mounted no major attacks outside southern Russia for at least a year.
The derailed train was an express service traveling between Moscow and Russia's second city of St Petersburg - one of the country's busiest rail routes.
Sixty passengers and train crew were injured in the derailment, of which 38 were admitted to hospital, a spokeswoman for rail operator Russian Railways said. About 250 people were on board in all.
The incident happened late on Monday near the village of Malaya Vishera in the Novgorod region, about 500 km (300 miles) north of Moscow and 170 km from St Petersburg.
The train came off the tracks just after crossing a bridge over a road, said a Reuters photographer at the scene.
"The cause of the accident, as ascertained by the competent organs, was a rupture of the railway tracks by an improvised explosive device," a Russian Railways spokeswoman said.
"As a result of this the train came off the rails and the tracks were very badly damaged - about 800 metres (2,600 ft) of track were badly damaged."
'We heard two explosions'A conductor on the train showed Reuters a video he recorded on his telephone of a crater about 2 meters (6 ft) across that could be seen on the bridge, where the rails should have been.
"We heard two explosions, then the train put on the brakes suddenly," one conductor, who did not want to be identified, told Reuters.
"The train shook. A panic started," he said. "We smashed out the glass and helped the passengers out ... The worst damage was in the restaurant car. That is where most of the casualties were."
The Reuters photographer said nearly all of the carriages and the locomotive were off their tracks, while at least three carriages were tipped onto their side.
Powerful lights were set up by the tracks as investigators from the Federal Security Service inspected the site and railway workers with cutting equipment removed damaged rails.
One passenger described the moments after the blast. "It was terrible. People were thrown to one side and there was this smell of burning," Viktoria Kovbas told Vesti-24 television.
"There was an explosion, a real explosion ... The restaurant car is crumpled up like an accordion."
Rebel fighters linked to Chechnya have used bombs to target passenger trains in the past.
In 2003, an explosion tore through a morning commuter train outside Yessentuki, north-west of Chechnya, killing 46 people.
In 2005, a passenger train heading from Chechnya to Moscow was derailed about 150 km from the Russian capital. Eight people were treated in hospital.