I don't see the Spanish jumping into the war just because they gave refuge to the Pope, nor even out of revenge for the insult to the Papacy nor at the Pope's urging. Loyalty to Mother Church is one thing; sticking their head on the chopping block is another. If they join FAR as a belligerent, it is Britain they have to fear. The British can't land--well, they are landed, at Gibraltar, but if the Rock is hard to take, it is also, I gather, hard to fight their way out of too. Or the Portuguese can give them their ports and a front, but Portugal would suffer badly too. It isn't invasion they have to worry about, not for some years anyway. No, it's blockade. The RN can shut down Spanish trade and the French can't stop them; Spain, I gather, is rather dependent on imported goods and this will hurt Spain directly. And of course she can kiss her colonies bye-bye, and without them Spain is a third-rate power of no great importance. Among colonial powers, the same is already true, but at least she has that status currently--she won't within months of joining FAR, and then her only hope is that FAR prevails so sweepingly that even the British, who will never be crushed directly and will not lose control of the sea, will nevertheless agree to restore Spain's colonies, after years of their being under alien control that will doubtless compound the headaches of trying to hold them.
Meanwhile as a neutral, Spain can not only meet her own needs for imports but serve as a backdoor for French trade as well; too much of that would invite British restrictions, but then the onus of starting the war would be on the British, as would the opprobrium of cutting the Pope off from the larger world--the Catholic Irish majority might have something to say about that!
So, while I've been quite wrong prognosticating this timeline before, and may be yet again as I surely will be in future, my guess is, the Spanish regard sheltering the Pope as their fair contribution to the alliance that does have their sympathy. The Pope will be safe in Spain (assuming that related events don't trigger a radically anti-clerical rebellion, such as would wrack Mexico within a couple decades OTL, and Spain itself within a couple generations, so that's not unthinkable) and have a "bully pulpit" from which to denounce the perfidity of OBGI and the infidelity of any Catholics residing in these nations, including all of faithless Italy of course. But in principle, the
Catholic Church is not a belligerent party! It's supposed to be the one true Church founded by the Prince of Peace for the redemption of all humanity; that this benign neutrality has been honored more in breach than observance in the past couple thousand years is a major reason a lot of people hate it and even fear it of course!
But Spain can take the position that they are not in this war, keep their trade lanes open, retain her grip on the colonies (as best she can, the British won't be doing them favors, but they will maintain a correct protocol and not interfere nor allow others to invade) and still turn a brave face to the French and Austrians, proud to have done her part, keeping the Pope safe and the lines of communication open between the exiled See and faithful Catholics on both sides and in neutral nations, the world over. (The Russians might be less impressed, but they are far away).
So, while in the heat of the moment someone in Madrid might do something stupid, I'd certainly advise the Spanish government to stand pat--and start collecting favors the Pope now owes them. And demur, most politely and reverently, if he hotheadedly insists they throw in with the war, pointing out that then the Catholics of both OBGI and the neutrals would be cut off from his spiritual guidance.