A total of 31,219 people entered Spain without permission last year, down from 41,945 in 2021 -- a drop of 25.6 percent and a second straight yearly decline, the ministry said in its annual migration report.
The interior ministry credited "cooperation with countries of origin and transit" of migrants, and the reinforcement of the fight "against mafias that traffic people" for the fall.
Migrant arrivals by sea decreased across the country but the most significant fall occurred in Spain's Canary Islands in the Atlantic off northwest Africa.
The number of migrants who arrived by sea in the archipelago fell to 15,682 in 2022 from 22,316 in the previous year, about 30 percent less.
The Atlantic route from West Africa to the Canary Islands had been increasingly used by migrant smugglers since the end of 2019 after safer routes to Europe in the Mediterranean were closed.
Boats have headed to the Canaries from Morocco or even Mauritania, Senegal or further afield, increasing the risk of the crossing.
But migrant arrivals by land in Spain's two North African enclaves of Ceuta and Melilla jumped by 24.1 percent in 2022 over the previous year to reach 2,289.
The two tiny territories have the European Union's only land borders with Africa.
In June around 2,000 migrants stormed the high fence that seals off Melilla from Morocco, according to Spanish authorities, and engaged in a two-hour skirmish with border officers.
The death toll -- at least 23 according to Morocco, at least 37 according to Amnesty and independent experts -- was the worst in years of attempted migrant crossings into Melilla and Ceuta.