All new colonial nation types have an interaction tab in the subject section with which you can lower the liberty desire between 10% and 20% (see screenshot below, all the -5% are from the interaction tab)
Also 20% can be reduced by having 200 relation and another 20% by having 100 trust for which you have to "curry favors" first in the diplomacy menu
You can also reduce the tariffs and switch from the self-governing type to the crown colony type.
But 50 mercantilism is crazy high if you want to keep your colonies, you should see this is as a "lesson learned" game to keep this number low in the first place if you want to keep them. Also as Spain it is imo a good idea too keep Portugal longer in the PU instead of integrating them ASAP, you should keep them at at least as long as they have established their own colonial nations everywhere, it is easier to keep them in line when two colonial nations a sharing a region.
View attachment 748299
Edit: Further the Alhambra in Granada is giving directly -10% liberty desire on level 3 and another 1 diplomatic reputation which equals to another -3%.
You can get another 2 diplomatic reputation by building Petra in Maan and 1 diplomatic reputation by building the Kanbawzathadi Palace in Pegu, so another -9%.