Obama and Spanish Prime Minister Jose Luis Rodriguez Zapatero also discussed Iran and the global economy during lunch and bilateral meetings at the White House.
"Spain and the United States are working together on some of the most difficult security issues that we face in the world," Obama said, adding he thanked Zapatero "for the partnership with Spanish forces in helping to bring security and stability to Afghanistan and to help train Afghans so that they can provide for their own security."
Regarding the Middle East and the need for a two-state solution for Israel and Palestine, Obama said the Spanish prime minister will travel to region after he leaves Washington.
"And we both agreed that the time is right for a resumption of negotiations between the Palestinians and the Israelis in order to create two states that are living side by side in peace and security," Obama said.
Zapatero said he thought now represented a "moment of opportunity" to bring about peace in the Middle East, key to build peace throughout the world.
He repeated Spain's commitment to help in Afghanistan as "firm" and "solid."
"And we're guaranteeing the stability, the security, reducing radicalism and Taliban is essential in order to make it possible for their people to have a future," Zapatero said.
Regarding the global economy, Obama said, "(Obviously) the United States and Spain are both working diligently to put our people back to work and recover from what has been the worst recession in decades."