Spanish Inquisition
Philosophical and religious reasons

The creation of the Spanish Inquisition was consistent with the most important political philosophers of the Florentine School, with whom the kings were known to have contact (Guicciardini, Pico della Mirandola, Machiavelli, Segni, Pitti, Nardi, Varchi, etc.) Both Guicciardini and Machiavelli defended the importance of centralization and unification to create a strong state capable of repelling foreign invasions, and also warned of the dangers of excessive social uniformity to the creativity and innovation of a nation. Machiavelli considered piety and morals desirable for the subjects but not so much for the ruler, who should use them as a way to unify its population. He also warned of the nefarious influence of a corrupt church in the creation of a selfish population and middle nobility, which had fragmented the peninsula and made it unable to resist either France or Aragon. German philosophers at the time were spreading the importance of a vassal sharing the religion of their lord.

The Inquisition may have just been the result of putting these ideas into practice. The use of religion as a unifying factor across a land that was allowed to stay diverse and maintain different laws in other respects, and the creation of the Inquisition to enforce laws across it, maintain said religious unity and control the local elites were consistent with most of those teachings.

Alternatively, the enforcement of Catholicism across the realm might indeed be the result of simple religious devotion by the monarchs. The recent scholarship on the expulsion of the Jews leans towards the belief of religious motivations being at the bottom of it. But considering the reports on Ferdinand's political persona, that is unlikely the only reason. Ferdinand was described, among others, by Machiavelli, as a man who didn't know the meaning of piety, but who made political use of it and would have achieved little if he had really known it. He was Machiavelli's main inspiration while writing The Prince.
detectable_content:postscript