It seems based on the text from Helen Vella Bonavita book Key to Christendom and George Cassar, a professor in Malta, book Defending a Mediterranean island that the Spanish were not necessarily intending to retake the island, but hoping to defend it.
The Knights Hospitaller at the time existed on Malta only because of a land grant by the Spanish crown in 1530 from Holy Roman Emperor, and king of Spain, Charles the Fifth. By giving the Knights this territory Charles would be placing an enemy of the Ottomans directly capable of raiding their trade routes in the Mediterranean without risking the provocation of the Sultan. Thus:
By passing on Malta to others, the Spanish kings were thus continuing to play their centuries-old win-win game of keeping Malta within their realm without having to pay for its upkeep and protection, yet resting their minds that there was a trusted vassal administering their property
Additionally in Bonavita book she writes:
Since the fall of Constantinople in 1453 its constant aggresive expansion had been a constant conecern to politcal and relgious writers alike. The complete fear of Ottoman Domination that appears in so many of the texts concerning the Turks in the sixteenth centruy.
From this we can gather that much of Europe during the sixteenth centruy was in fear that the Ottoman Empire might swallow them whole. And with the fall of Constantinople in 1453 much of Europe began to take defensive stance towards Ottoman agression. In 1564 when the Ottomans began to amass an armada to invade Malta most of Europe began to prepare defenses as they were in fear over where the Ottomans might strike next.
When the Ottomans did strike in 1565, Spain immediately began conscripting a relief force for the island of Malta lead by Don Garcia which didn't arrive until September the 7th nearly 4 months later in the Gran Socorosso. However a small detachment led by the Spanish knight Don Melchior de Robles arrived sometime in July indicating that Spain was actively thinking of defending the island. (Below is a painting of Don Robles relief force that arrived in July 1565)
While the knights had considerably beaten back the turks by the time the relief force had arrived in September the Turks had still been in the middle of sieging the fortress. It wasnt until the combined Spanish relief forces arrival that the Turks were finally routed and the Knights saved.
Furthermore, the arrival of Don Garcia's relief force 4 months into the siege only occurred because it took Spain that long to assemble troops and ferry them to Malta. Spain had no incentive to necessarily recapture the island from the Knights because they had gifted the island to them and kept them as loyal vessels. Instead Spain was actively trying to defend the island the entire four months because retaking the island would be a costlier process then simply defending their ally who already controlled it.