Santiago Sánchez Cogedor left his hometown near Madrid in January, hoping to make the epic journey in time for the November 20 competition.
But his family had not heard from him for almost a month.
“The foreign ministry confirmed he was being held in Iran and that his state of health was good,” Celia Cogedor told Spanish TV channel Trece late on Thursday.
The Spanish ambassador to Iran is taking steps to “ask the Iranian authorities for authorisation to visit him”, she added, without saying what he is accused of or where he is being held.
Cogedor had been documenting his journey on Instagram and in his last post on October 1st, he said he was about to enter Iran from a northern Iraqi village.
He then told his parents in a voice message that he was going to Tehran, before heading to the port of Bandar Abbas to take a boat to Qatar.
Iran has been gripped by six weeks of protests and a deadly crackdown from security forces after the death of 22-year-old Mahsa Amini in custody.
She had been arrested by the notorious morality police for allegedly breaching the country’s dress code for women.
Tehran mainly accuses the United States of being behind the demonstrations.
Last month Iranian authorities announced the arrest of nine foreigners, including from Poland, Italy and France, allegedly in connection with the protest movement.
The Spanish foreign ministry refused a request for comment, referring AFP back to Cogedor’s family.