BERLIN — Chancellor Angela Merkel of Germany will host President Vladimir V. Putin of Russia for talks near Berlin this weekend, in a surprise move that analysts said showed how foes and allies of the United States alike were shifting in response to the Trump administration’s sweeping tariffs and unpredictable diplomacy.

The chancellor and the Russian president will meet on Saturday at the German government’s version of Camp David, Ms. Merkel’s spokesman, Steffen Seibert, told reporters on Monday. He said the talks were expected to focus on the situation in Syria, violence in eastern Ukraine and a joint pipeline for natural gas.

But analysts said that beyond the detailed points of the meeting might be an attempt to strengthen alliances and exchange ideas about how best to respond to President Trump’s tariffs. Both Russia and Germany have been hit by tariffs on aluminum and steel, and both fear the ripple effects of Mr. Trump’s recent measures against Turkey.

The German and Russian leaders last met in May, when Mr. Putin welcomed Ms. Merkel to his residence in the Black Sea resort town of Sochi.