Cuban President Raul Castro hailed a landmark exchange of prisoners with the United States on Wednesday and praised U.S. President Barack Obama as the two countries agreed to normalize relations after more than five decades of hostility. The United States freed three convicted Cuban spies in return for the release of U.S. foreign aid worker Alan Gross, imprisoned in Cuba in 2009, and of an intelligence agent who spied for the United States and had been held for nearly 20 years.

"We need to learn to live together in a civilized way, with our differences," Castro said in televised address that touched off jubilation in the streets of Havana, where the Cuban spies are considered heroes.

Castro, known for his low-key style, avoided triumphal statements in his televised address but said their release was a cause of "enormous joy for their families and all of our people."

Two other agents had previously been released upon serving their sentences. Images of the "Cuban Five" cover billboards across the country, and the men are referred to as "anti-terrorist heroes" in official media for their work in spying on extremist Cuban exile groups in Florida.

In a rare nod to a sitting U.S. president, Castro praised Obama for agreeing to the prisoner exchange and pushing for a new relationship with Cuba.

"This decision by President Obama deserves respect and recognition by our people," Castro said, speaking at the same time that Obama announced his administration would restore diplomatic relations.

Castro, 83, became Cuba's president in 2008, taking over from his older brother Fidel Castro.

Since then, he has moved to encourage more private enterprise with modest economic reforms, although he has insisted the changes are aimed at strengthening communist rule.

He went to Havana's international airport on Wednesday to receive the three Cuban intelligence agents released after serving 16 years in U.S. jails.

Cuban state television showed footage of the three exchanging hugs with Castro, relatives, friends and government officials.

Gerardo Hernandez, 49, the leader of the group, had been serving a double-life sentence for conspiracy to murder in connection with the Cuban air force's shooting down of U.S. civilian aircraft in 1996.

The other two, Antonio Guerrero, 56, and Ramon Labañino, 51, had been due to be released in the coming years.

"General, we are still so emotional we don't have the words, but what we have in excess is gratitude," Hernandez told Castro, referring to him by his military rank.