As I was uncertain about the premise of this question—i.e., it looks as if there are fewer Spanish and Portuguese mathematicians than others—but without the numbers to prove it, I went in for some research on the OP's Cambridge website.
In short, while there is some basis for the claims, I don't think the situation is as dire as claimed. Below is a table I compiled based on only the mathematicians on that website; I checked it for duplicates (because their sorting is horrible so "De L'Hôpital" was there thrice as, "De L'Hôpital", "L'Hôpital, De", and "Hôpital, De L'" and as this is relatively frequent in Dutch, French, and Italian names then there were quite a few duplicates).
The second thing to note is that this is based on the country of birth and century of death (the former, from the database, and the latter, make things simpler for myself).
I included Argentina, Brazil, Chile, Cuba, Mexico, Uruguay, and Venezuela to see if any then-Spanish imperial territories produced any mathematicians of note. Mexico in the 17th century is the only really relevant one for our purposes.
Overall, Spain is notable for coming in early—due to the Islamic centers of learning in al-Andalus while also managing to hold its own up to the 16th/17th century. It is notable that the large expansion of English, French, German, and Italian mathematicians in the 16th to 17th century is not replicated in Spain or Portugal (Portugal, notably, also missed out on large cities and centres of learning during the Islamic period).
It is clear that this coincides with vast Spanish and Portuguese expansion across Central and South America and in the Indian Ocean. The Counter-Revolution already mentioned in @UriGranta's answer was clearly relevant in trying to stem the tide of Enlightenment and reason. The Iberian nobility's opportunity to enrich itself in the plentiful colonies was also relevant in directing possible investments away from engineering schools to those of theology (to justify expansion and train missionaries to evangelize in the colonies).
The Bourbon Reforms section from Wikipedia is instructive:
A slow economic recovery began in the last decades of the 17th century under the Habsburgs. Under the Bourbons, government efficiency was improved, especially under Charles III's reign. The Bourbon reforms, however, resulted in no basic changes in the pattern of property holding. The nature of bourgeois class consciousness in Aragon and Castile hindered the creation of a middle-class movement. At the instance of liberal thinkers including Campomanes, various groups known as "Economic Societies of friends of the Country" were formed to promote economic development, new advances in the sciences, and Enlightenment philosophy. However, despite the development of a national bureaucracy in Madrid, the reform movement could not be sustained without the patronage of Charles III, and it did not survive him.
... Castile's exchequer still used Roman numerals and there was no proper accounting.
In other words, the monarch who ruled was extremely important to maintain any forward momentum. Yet, after the Siglo de Oro, late 17th century Spain essentially languished under Carlos II until the Bourbon monarchs were instated—Felipe V was not a great improvement, and only Fernando V and Carlos III managed to carry out some much needed reforms. Nevertheless, what no king managed to reform was the society in which nobility and feats of arms were honoured more than learnedness. Similarly, the merchant class stayed relatively weak. It is, of course, up for discussion whether the monarchs actually wanted to promote sciences over merely preferring the result of science (and engineering) (such as monumental architecture, etc...).
Friar Benito Jerónimo Feijóo y Montenegro gave this some thought in the mid-18th century, as described below:
If Philip V took the unprecedented step of allowing foreign academicians to enter his overseas domain , it was in part because , by the early eighteenth century, Spain had acquired a reputation abroad for intellectual retardation . Once feared for its intransigent Catholicism , the Peninsula was now scorned for its cultural inertia . The revolution in science associated with the names of Copernicus, Galileo, Kepler, Boyle, Leibniz and Newton was a European movement in which Spaniards were conspicuous only by their absence. As the Benedictine abbot, Benito Jerónimo Feijoo (1676–1764), admitted in his Teatro critico universal (1726–39), 'physics and mathematics are almost foreigners in Spain'. Indeed, he confessed that in the study of nature Spanish universities still relied on Aristotle, pinned like faded butterflies to the level of 1600. A devoted reader of the memoirs of the French Academy of Science and of other learned societies, Feijoo sought to transmit to a broad public some notion of the recent advances in knowledge, at all points emphasising the primacy of observation and experiment over argument and authority. ...
—Brading, 'The First America'
Admittedly, Brading doesn't cite the reasons why Feijoo thought so, however, even when the Crown started to sponsor scientific expeditions the interest did not seem to immediately extend to mathematics.