Edmundo González Urrutia arrived on Sunday afternoon with a Spanish military plane, with the official message that the Spanish Foreign Minister José Manuel Albares had granted asylum.
González Urrutia's opposition colleague María Corina Machade welcomed the news, saying "his life was in danger".
In the face of brutal reality and for our cause, it is necessary to protect his freedom, integrity, and life, she says.
The Spanish Prime Minister Pedro Sánchez described the opposition leader as "a hero that Spain will not abandon".
Wants to "restore calm"
Edmundo González Urrutia has largely lived in hiding since the disputed presidential election in July.
"After voluntarily taking refuge in the Spanish embassy in Caracas a few days ago, González Urrutia asked the Spanish government for political asylum", wrote Venezuela's Vice President Delcy Rodríguez. The government decided to grant him safe passage out of the country to "restore political peace and calm".
However, international criticism of the regime in Caracas remains sharp. The EU's Foreign Minister Josep Borrell reiterated the demand that "oppression, arbitrary arrests, and harassment" must cease in Venezuela.
Disputed victory
Venezuela has been plunged into a political crisis after the presidential election in July, which both the opposition and the sitting President Nicolás Maduro claim to have won.
The EU, the US, the UN, and several of Venezuela's neighboring countries have questioned Maduro's claim to victory since the election data has not been fully disclosed.
The unrest that followed the election claimed 27 lives, while nearly 200 people were injured. About 2,400 people were arrested in connection with the protests, according to the government.