Sasha Sobhani, a 33-year-old musician, appeared in court in Madrid after Iran accused him of running illegal gambling websites and money-laundering.
He denied the charges and warned he was at risk of torture if he was sent back.
He said Iran's government was angry about criticism of it he had shared with his 2.6m followers on Instagram.
Mr Sobhani spent much of his childhood living outside the country because of his father's career, which involved postings to Armenia, Gabon and Venezuela.
He told the Spanish newspaper El Mundo that he had stayed in Venezuela after his father finished as ambassador there in 2006 and returned to Tehran to serve as deputy foreign minister in the government of then hardline President Mahmoud Ahmadinejad.
Mr Sobhani eventually moved back to Iran, where he gained a following on social media as one the "Rich Kids of Tehran", an Instagram account that chronicled the lives of the capital's wealthy young elite.
He also ran afoul of the authorities by organising raves. He said he was arrested and sentenced to prison, but that he later managed to flee to Turkey.
He moved to Spain two years ago, when he began sharing photographs showing himself with scantily clad women, alcohol, fast cars and private jets.
He also posted videos for his Persian-speaking followers that were critical of the Iranian government.
"I criticise the regime, the lack of freedom they have, I teach them how I live and tell them that they too could live like this. And of course, Iran cannot allow the son of a high official to say those things," he told El Mundo.
Last week, Spanish authorities acted on an Iranian extradition request, which accused Mr Sobhani of running gambling websites that are based outside Iran but are illegal under Iranian law.
Mr Sobhani denied he was involved at a court hearing, stressing that he only had contracts to advertise such sites. He also vowed to fight extradition.
"There they would torture me until I begged them to kill me," he said. "I prefer a grave in Spain than a prison in Iran, but I trust Spanish justice."
In December, Iranian police said they had arrested more than 30 people "active in the field of gambling" as part of a crackdown. They reportedly included some Instagram influencers with more than a million followers each.
Iran's central bank also warned that the identities of 70,000 "active gamblers" had been handed over to the judiciary. It warned that people who ignored warnings to stop gambling faced prosecution.