Under the influence of this exasperation, the queen resolved to seek reconciliation with Austria, that all friendly relations might be abandoned with France, and that Spain and Austria might be brought into intimate alliance to operate against their common foe. A renowned Spanish diplomatist, the Baron of Ripperda, had been for some time a secret agent of the queen at the court of Vienna, watching the progress of events there. He resided in the suburbs under a fictitious name, and eluding the vigilance of the ministry, had held by night several secret interviews with the emperor, proposing to him, in the name of the queen, plans of reconciliation. Letters were immediately dispatched to Ripperda urging him to come to an accommodation with the emperor upon almost any terms.
A treaty was soon concluded, early in the spring of 1725. The emperor renounced all claim to the Spanish crown, entered into an alliance, both offensive and defensive, with Philip, and promised to aid, both with men and money, to help recover Gibraltar from the English, which fortress they had held since they seized upon it in the war of the Spanish succession. In consideration of these great concessions Philip agreed to recognize the right of the emperor to the Netherlands and to his acquisitions in Italy. He opened all the ports of Spain to the subjects of the emperor, and pledged himself to support the Pragmatic Sanction, which wrested the crown of Austria from the daughters of Joseph, and transmitted it to the daughters of Charles. It was this last clause which influenced the emperor, for his whole heart was set upon the accomplishment of this important result, and he was willing to make almost any sacrifice to attain it. There were also some secret articles attached which have never been divulged.