The child had been missing since last August when her parents, Moroccan residents in the Catalan city of Hospitalet de Llobregat, allowed her to go on holiday with a Bolivian neighbour they were friends with.
The girl's mother and father spoke to local police when they were unable to contact the pair several days after they had landed in their alleged destination of Bolivia.
Spain’s Civil Guard and Catalonia's Mossos d’Esquadra police forces worked with Bolivian authorities to try to determine where the girl and her captor were located.
After seven months, police found the pair in a remote part of Bolivia's Cochabamba region.
They were hidden away deep inside Bolivia’s Amazon rainforest in a terrain barely reachable by car, Catalan daily La Vanguardia reported on Tuesday.
The alleged kidnapper, 35-year-old Grover Morales, faces charges of human trafficking and sexual abuse, Bolivian press are reporting.
He told local television stations he had permission from the girl's parents to marry her as he was a Muslim convert.
Story continues below…
The girl has undergone medical and psychological tests in the city of Cochabamba and will be travelling to Spain soon to be reunited with her parents.
A judge will release more information in coming days.