Steinmeier, a Social Democrat who had served as foreign minister until last month, won 931 of the 1,260 votes by lawmakers and representatives of Germany's 16 federal states, Reuters reports.

His predecessor, Joachim Gauck, steps down on March 18.

The German constitution mandates that a special assembly is convened to elect presidents. It includes 630 lawmakers in the Bundestag lower house and an equal number of representatives from the federal states.

Read alsoSteinmeier: Germany must prepare for 'turbulent' times under TrumpSteinmeier was an outspoken critic of Donald Trump during the US election calling him a "preacher of hate," according to Euronews.

Last month he warned Trump against dismantling the 2015 nuclear accord with Iran.

Steinmeier has pushed hard to end fighting between Ukrainian forces and Russian-backed separatists in eastern Ukraine, and condemned Russia’s 2014 annexation of Crimea.