Eleven victims were killed at the scene, one died in an ambulance and two more at the hospital, Russia's health minister Veronika Skvortsova told reporters. Forty-nine wounded were still hospitalized, she said.
Russia is home to a large diaspora of Central Asian migrants who flee poverty and unemployment in their home countries for jobs in Russia.
Let our news meet your inbox. The news and stories that matters, delivered weekday mornings.
In the past two decades, Russian trains and planes have been frequent targets of terrorism, usually blamed on Chechen separatists or Islamic militants, but St. Petersburg — a major tourist destination famed for its imperial palaces and lavish art museums — had been spared previous attacks.
"From now on, I will be scared to take the subway," said Marina Ilyina, 30, who brought flowers to the station where the train stopped after the bombing. "We in St. Petersburg thought we wouldn't be touched by that."
Putin laid flowers to honor the victims overnight, according to official state news service TASS. The president stepped out of his car in Moskovsky Prospekt Avenue with a bunch of scarlet roses.
The blast happened when the train was between the Sennaya Ploschad and Tekhnologichesky Institute subway stations.The second device was found at Ploshchad Vosstaniya station. It was loaded with shrapnel and contained up to 2.2 pounds of explosives, Interfax reported.
There was praise for the train driver, who took the damaged cars forward so that victims could be treated more quickly by first responders. Alexander Kavernin, 50, told reporters Tuesday he heard the sound of a blast while his train was running, raised the alarm and carried on to the station.
"I had no time to think about fear at that moment," he said.
Jitters were underscored Tuesday as several stations were briefly closed amid fresh bomb threats.
In a phone call with Putin, President Donald Trump offered condolences, the White House said in a statement. Trump also pledged to support Russia's response to the attack and its pursuit of justice, the statement said.
"Both President Trump and President Putin agreed that terrorism must be decisively and quickly defeated," the statement said.
On Jan. 24, 2011, a suicide bomber blew himself up at Moscow's Domodedovo Airport, killing 37 people and wounding 180. The same airport in August 2004 saw Islamic suicide bombers board two airplanes and bring them down, killing a total of 90 people.
Alastair Jamieson reported from London.
Alastair Jamieson is a London-based reporter, editor and homepage producer for NBC News.
Alan Kaytukov and The Associated Press contributed.