US President Barack Obama and Russian President Vladimir Putin agreed on Sunday on the need for UN-sponsored peace talks and a ceasefire to resolve years of war in Syria, a White House official said.

US President Barack Obama, left, speaks with Russian President Vladimir Putin, right, prior to the opening session of the G-20 summit in Antalya.(AP)

US President Barack Obama and Russian President Vladimir Putin agreed on Sunday on the need for UN-sponsored peace talks and a ceasefire to resolve years of war in Syria, a White House official said.

The two leaders spoke during a short and unannounced summit meeting over a coffee table on the margins of a G20 summit in the Turkish resort of Antalya.

“President Obama and President Putin agreed on the need for a Syrian-led and Syrian-owned political transition, which would be preceded by UN-mediated negotiations between the Syrian opposition and regime as well a ceasefire,” the official told reporters after the meeting.

The two “held a constructive discussion” that lasted about 35 minutes, the official added, calling the need for a solution for Syria “an imperative made all the more urgent by the horrifying terrorist attacks in Paris.”

The official, who wished to remain anonymous, said Obama welcomed efforts by all nations to confront Islamic State jihadists in Syria amid Western suspicions that Russia’s intervention is really aimed at propping up Syrian President Bashar al-Assad.

A top Kremlin official said that while Moscow and Washington shared “strategic objectives” to fight Islamic State, divergences still existed.

“Differences on tactics still remain,” Putin’s foreign policy advisor Yuri Ushakov told reporters on the sidelines of the summit.

Obama also offered his “deep condolences for the loss of Russian life” in the bombing of a Metrojet passenger flight in Egypt killing all 224 people on board in Russia’s worst air disaster.