Cuba has agreed to free 52 political detainees in the largest prisoner release by the communist authorities for decades.
The move follows talks in Havana with officials from Spain and the Roman Catholic Church.
Five prisoners are expected to leave jail soon, while the rest will be freed in the next few months.
Spanish Foreign Minister Miguel Angel Moratinos, in Havana, said the move "opens a new era in Cuba".
Mr Moratinos, who took part in the talks, also expressed hopes that it could help to put "aside differences once and for all on matters of prisoners".
The minister said that Spain was willing to take in all 52 prisoners, who were arrested in a major government crackdown in 2003.
The Cuban government has been under pressure to free dissidents since a prisoner on hunger strike, Orlando Zapata Tamayo, died in February.
His death prompted another dissident, Guillermo Farinas, to launch a hunger strike that has lasted more than 130 days.
Cuba has always denied that it has political prisoners, calling them mercenaries paid by the United States to undermine Havana's rule, says the BBC's Michael Voss in the capital.
But President Raul Castro has been stung by the strength of international criticism following the death of Mr Tamayo in February, our correspondent adds.
Agreement to release the prisoners came after talks between Mr Castro and Havana's Roman Catholic Archbishop, Cardinal Jaime Ortega.
The accord was announced by Church officials in Havana.
Mr Moratinos and his Cuban counterpart, Bruno Rodriguez, were also present at the meeting in Havana.
Cardinal Ortega said five detainees - whose names were not released - would be freed soon and allowed to depart for Spain, accompanied by their relatives.
The releases will leave 110 political prisoners in Cuban jails, according to a count by the island's leading human rights group, the Cuban Commission on Human Rights.
Commission spokesman Elizardo Sanchez said he was surprised that the government was releasing so many detainees but he added that the move did "not mean a significant improvement in the terrible situation of human rights that exists in Cuba".
He argued that "forced exile in Spain" was not the same as unconditional freedom.
Laura Pollan, leader of the dissident group Ladies in White and wife of jailed dissident Hector Maceda, said her group sensed that Cuba was "at the doors of a... significant change".
She told the Associated Press news agency that she hoped it would be "a true change, the first steps of a true freedom, of a true democracy".
But she added that she thought the government might not follow through with its promise: "I don't think they will let everyone go; I think only some will be."
A spokesman for Human Rights Watch, a US-based campaign group, welcomed the news but said: "The government makes a show of releasing prisoners but then it does nothing to dismantle the repressive machinery it has in place to imprison people and it continues arresting them."
The last time Cuba released a significant number of political prisoners was after Pope John Paul II visited in 1998, when 101 were set free.
Twenty years before that, Fidel Castro freed 3,600 political prisoners after meeting Cuban exiles.
There was no immediate word from Mr Farinas, 48, who has said that he will only end his hunger strike when all political prisoners in Cuba are released.
Recent news of his condition was reported in Cuban state media, which usually ignore dissident protests.
The official communist party newspaper Granma published an interview with the doctor leading his treatment, Armando Caballero.
Dr Caballero said the patient had gained weight due to intravenous feeding since being moved to hospital on 11 March after collapsing at his home in Santa Clara.
But a blood clot had formed in his neck and he was also suffering from an infection that could make further intravenous feeding impossible, the doctor said on Saturday.