The hostages were freed after a raid carried out in a rural area of northeast Colombia following an operation by a specialist anti-kidnapping unit.
The head of the unit, Humberto Guatibonza, said the kidnappers were located after a partial ransom was paid to accomplices in Spain.
One of the captives, Maria Concepcion Marlaska Sedano, 43, is a family member of a senior Spanish judge, Fernando Grande-Marlaska.
The kidnappers had demanded €500,000 in ransom. Part was paid to alleged accomplices in Spain, who were then arrested.
That payment divided the kidnapping gang, as some wanted to free the captives and others wanted to press for the rest of the money, said Guatibonza.
From the detainees police learned the captives, who were kidnapped on May 17th, were being held in a remote area of La Guajira province near the border with Venezuela.
Upon arrival in Bogota they did not speak to reporters but gave the thumbs up sign.
President Juan Manuel Santos praised the rescue in a message on his Twitter account. "Liberation of Spanish tourists confirms the effectiveness of the police and their efforts to build a safe country," he wrote.