The US has missed a deadline that had been set to close the prison camp
Spain is willing to take in five inmates from the US military prison at Guantanamo Bay, Cuba, it says.
Foreign Minister Miguel Angel Moratinos made the announcement on Monday. He had previously said Spain would take in two detainees - a Yemeni and a Palestinian.
None of the names, nor the nationalities of the three others, have been revealed.
The transfers are part of US President Barack Obama's efforts to close the controversial facility.
Mr Obama set himself the deadline of 22 January 2010 to close the camp, shortly after being sworn in as president.
That deadline has been missed, and while more than 40 terror suspects have been transferred out of the prison during Mr Obama's first year in office, nearly 200 remain.
Mr Obama has subsequently said he wants the camp closed in 2010, without identifying a specific deadline.
A number of foreign countries have taken former Guantanamo inmates, signalling their willingness to help Mr Obama, but few have taken as many as five.
Mr Moratinos said: "It will obviously be done with every legal guarantee needed in order to defend the country's security and legal situation."