Officers detained Cabrera Ruiz on Thursday at a hotel in the northern city of Logrono in the heart of the Rioja wine region, police said in a statement.
Cabrera Ruiz, the target of a international arrest warrant issued by the Dominican Republic, was carrying false Costa Rican identity documents at the time of his arrest, it added.
Spanish police said he topped the list of the Dominican Republic's most wanted fugitives and is considered to be “the main drug trafficker and money launderer” in the Caribbean nation.
Dominican Justice Minister Francisco Dominguez said Cabrera Ruiz's crime ring shipped drugs to various countries and was linked to dozens of killings in turf wars, when he presented a list of the country's 17 most wanted felons in September 2015.
Spain's close ties with its former colonies in Latin America have made it the main entry point used by drug smugglers to bring cocaine into Europe.