Russian president Vladimir Putin has congratulated Germany's new "anti-Trump" president and invited him to the Kremlin.
Frank-Walter Steinmeier was elected president by an overwhelming majority.
He strongly criticised Donald Trump during the US election campaign.
When asked in August about the rise of right-wing populism in Germany and elsewhere, Mr Steinmeier criticised those who “make politics with fear”.
He cited the nationalist Alternative for Germany party, the promoters of Britain’s exit from the European Union, and “the hate preachers, like Donald Trump at the moment in the United States”.
The daily Berliner Morgenpost billed Mr Steinmeier as “the anti-Trump president”.
The Russian president "expressed confidence that Mr Steinmeier’s work as President of Germany will promote Russia-Germany relations and efficient cooperation in various sectors in the interests of the citizens of both nations, in line with reinforcing stability and security on the European continent and globally," a Kremlin press release said.
The German president has little executive power, but is considered an important moral authority and symbol of the country as its host for visiting dignitaries.
"Let's be brave, because then we don't have to be afraid of the future," Mr Steinmeier said in his acceptance speech.
He said the world faces "rough times," but that Germany, as a functioning democracy, had the responsibility to fight for stability.
"Isn't it actually wonderful, that this Germany, our difficult fatherland, that this country has become an anchor of hope in the world for many," after overcoming wars and totalitarianism, Mr Steinmeier said.
Chancellor Angela Merkel congratulated Mr Steinmeier and said she was convinced he would be an excellent president who would have the support of the vast majority of the people.
"This is a good day for Germany," Ms Merkel said.