LIMA (Reuters) - U.S. President Barack Obama and his Russian counterpart Vladimir Putin spoke for around four minutes on Sunday at the APEC summit about Syria and Ukraine, in what is likely to be their last in-person meeting before Obama leaves office.

The two men met at the start of the summit meeting in Lima, Peru's capital. They exchanged pleasantries and remained standing as they spoke.

Obama later said at a news conference he told Putin the U.S. is deeply concerned about bloodshed and chaos in Syria "sown by constant bombing attacks" by the Syrian and Russian militaries, and that a ceasefire and political transition were needed.

"As usual I was candid and courteous but very clear about the strong differences we have on policy," Obama said.

Putin said at a separate news conference he thanked Obama during Sunday's meeting in Lima "for the years of joint work".

"I told him that we would be happy to see him (Obama) in Russia anytime if he wants, can and has desire", Putin said.

Obama and Putin have had a challenging relationship. The U.S. president said last week he had warned Putin about consequences for cyber attacks attributed to Moscow that were seen as trying to influence the U.S. election.

Obama said he also urged President Putin to help implement the Minsk peace agreement by working with France, Germany, Ukraine and the United States to halt the conflict in Donbass region of Ukraine.

During his race for the White House, Republican President-elect Donald Trump praised Putin. Putin said on Sunday that Trump had confirmed to him that he was willing to mend ties.

(Reporting by Jeff Mason, additional reporting by Denis Pinchuk, Caroline Stauffer and Mitra Taj; Editing by Alan Crosby and Simon Cameron-Moore)