"President Putin of Russia called to thank me and the US for informing them of a planned terrorist attack in the very beautiful city of Saint Petersburg," Trump tweeted.
"They were able to quickly apprehend the suspects, with many lives being saved," he said. "Great & important coordination!"
Russia on Monday remanded into custody two men suspected of planning the New Year's Eve attack.
According to Russia's FSB security service, the two men had pledged allegiance to the Islamic State (IS) jihadist group.
The FSB said the two men had been detained Friday based on information provided from "American partners" and that both confessed to preparing attacks.
They were identified as 22-year-old Nikita Semyonov and 23-year-old Georgiy Chernyshov.
The local Fontanka news website reported that they planned attacks in a shopping center and a cathedral and had sent photos to IS contacts to confirm the targets.
Although Moscow and Washington are at odds on many issues, both regularly stress their mutual determination to fight terrorism.