At the Group of 20 summit in Russia, President Obama faced growing opposition from world leaders Thursday, advising him not to launch military strikes in Syria as punishment for a chemical-weapons attack.

Mr. Obama arrived in St. Petersburg for a showdown with Russian President Vladimir Putin, the summit host and the most forceful opponent of international action against Syria.

In their only public encounter of the day, Mr. Obama smiled as he approached Mr. Putin and shook his hand stiffly. They posed awkwardly for photographs for a few seconds.

The conference is being held at the 18th century Peterhof Palace complex, which was built on the orders of Czar Peter the Great.

As the summit’s first day unfolded, Mr. Putin appeared to have the upper hand on Syria.

China, the European Union, Brazil, Russia, India, South Africa and Pope Francis have all warned against military intervention without the approval of the U.N. Security Council, a venue where Russia’s veto power essentially ensures that such approval will not happen.

“Military action would have a negative impact on the global economy, especially on the oil price — it will cause a hike in the oil price,” Chinese Vice Finance Minister Zhu Guangyao said.

The pope urged the G-20 leaders to “lay aside the futile pursuit of a military solution.”

EU leaders characterized the Aug. 21 attack near Damascus as “abhorrent” but said: “There is no military solution to the Syrian conflict.”

But their arguments were unlikely to have much impact with Mr. Obama. Before a meeting with Japanese Prime Minister Shinzo Abe, Mr. Obama spoke of “our joint recognition that the use of chemical weapons in Syria is not only a tragedy but also a violation of international law that must be addressed.”

Ben Rhodes, the White House deputy national security adviser, told reporters traveling with the president, “The type of action we’re contemplating does not come with significant requirements of international participation, even as we welcome those countries that do want to express support for holding the Syrian regime accountable.”

“We would not anticipate every member of the G-20 agreeing about the way forward in Syria, particularly given the Russian position over many, many months now in terms of resisting efforts to hold the Assad regime accountable,” Mr. Rhodes said.

France is the only country to date that has said it is preparing to join U.S. military action.

The relationship between Mr. Obama and Mr. Putin was already strained, with Russia last month granting temporary asylum to fugitive National Security Agency leaker Edward Snowden. Mr. Obama has criticized Mr. Putin for having a “Cold War mentality” and for behaving “like the bored kid in the back of the classroom.”

Just before the summit began, Mr. Putin accused Secretary of State John F. Kerry of lying about the Syrian regime’s use of chemical weapons. Russia says it has evidence that Syrian rebels have launched chemical attacks.