Meeting in Berlin, they also criticised Russia's air strikes in Syria.
It was their first summit since Donald Trump won the US presidential election. Mr Trump has criticised Nato and said he hoped for warmer ties with Russia.
Meanwhile, Mr Trump and Nato's chief "underlined the enduring importance of Nato", the military alliance said.
In a statement, it said Nato General Secretary Jens Stoltenberg had spoken by phone to Mr Trump, congratulating him on his election victory.
In the German capital, President Obama - who has been on a farewell trip to Europe at the end of his two terms - met German Chancellor Angela Merkel, British Prime Minister Theresa May, French President Francois Hollande, Italian Prime Minister Matteo Renzi and Spanish Prime Minister Mariano Rajoy.
A White House statement later said the leaders had "affirmed the importance of continued co-operation through multilateral institutions, including Nato".
It said they had "agreed on the necessity of working collectively to move the transatlantic agenda forward, particularly on bringing stabilisation to the Middle East and North Africa".
On Ukraine, the leaders said the sanctions imposed against Russia must remain in place until Moscow fully met its commitments to resolve the conflict.
Western nations accuse Russia of sending its troops and weapons into eastern Ukraine to support separatist fighters - a claim Moscow denies.
On Syria, President Obama and the EU leaders said attacks on the city of Aleppo by Syrian government troops and Russia "should be immediately halted".
Mrs May said the leaders "were united in our condemnation of the atrocities that are taking place there".
"We agreed the need to keep up the pressure on Russia, including the possibility of sanctions on those who breach international humanitarian law," she added.
Russia launched its air strikes in Syria in September 2015, saying it was acting at the request of President Bashar al-Assad. Moscow denies targeting civilians, saying it is bombing Islamic militants.
In a separate development in Berlin, Mrs May said preparations for the UK's exit from the EU were "on track".
"We do stand ready to trigger Article 50... by the end of March 2017."
German Finance Minister Wolfgang Schaeuble earlier told the Financial Times the UK might have to continue paying into EU budgets for more than a decade after it leaves the EU.
He said Britain would "certainly have to fulfil its commitments" to the EU until its departure - and possibly after.
Outgoing US President Barack Obama and EU leaders have reaffirmed their commitment to Nato unity and sanctions against Russia over the Ukraine crisis.