In the first transfer of its kind, Hamad Abd al-Rahman Ahmad was handed over on Friday at the request of Spanish authorities, who wanted him as part of their investigation into al-Qaida activities in the country.
Spain is also seeking the extradition of three other men being held at Guantanamo Bay in the same probe.
Ahmad, from the Spanish North African enclave of Ceuta, was flown to Torrejon military airbase outside Madrid.
He was taken to the High Court in a police van and appeared briefly before a judge, who told him he faced prosecution in Spain on charges of belonging to al-Qaida network.
The judge, however, turned down a defence request to release Ahmad pending trial, but first sent him for a medical and psychiatric examination.
"It's a great day because he is a human being again," Ahmad's lawyer Javier Nart said.
Pierre-Richard Prosper, US ambassador-at-large for war crimes issues, told journalists that "Ahmad is the first one to be sent back for prosecution, but we expect to see more in the near future."
The US is holding without charge more than 600 people from several countries at the Guantanamo military camp in Cuba on suspicion they had links with the Taliban and al-Qaida.
Many have been held for up to two years, drawing an outcry from human rights groups around the world.