Near impossible, strictly speaking.
Montpellier was basically independent in several matters since the early XIIIth century, due to the growing disinterest of Aragon (and its sub-kingdom of Majorca) for the region, and importants right given by the Magna Carta of 1204.
Eventually it made Capetians used carrot and stick policies (protecting the city, to economical blocus) as the city was particularly important as a door for Mediterranean Sea. Eventually they spared no expense and acquired slowly but safely rights on the city, not unlike Capetians did for Lyons, until acquisition in early XIVth century.
At the time Spain became a thing in 1516, it was simply too late : not only France had a full grasp on the city, but Montpellier itself lost most of its importance with the Black Death, the loss of political autonomy and the Hundred Years War.
Arguably an Habsburg victory could make the Spanish border advancing North but it would be outside their main or even secondary priorities : Burgundy, Provence, Flanders, or even Brittany. Winning a long war to only gain a remote region looks implausible and would be less a spanish Montpellier than a spanish Bas-Languedoc.