The nationwide network sold fake work contracts, which let people apply for unemployment benefits, foreign resident permits, and, for inmates, open prison status, the Interior Ministry said.
"Up to now, 422 people have been detained including beneficiaries of the contracts, members of the criminal network and the leader," the ministry said in a statement.
Police arrested suspects in some 30 towns and cities across Spain, which has an unemployment rate of 26 percent.
The gang boss, who was not named but lived in the southern Spanish city of Jerez de la Frontera, worked with accomplices within the social security services, the authorities said.
He created up to 10 fake companies run mostly by drug addicts with criminal records who were paid for their roles.
People who bought the fake contracts were told to pay social security contributions to the gang leader, but that money never reached the government, the ministry said.
The value of the unemployment benefits and other losses to the state amounted to well over €2.6 million, it said.