There are some divergent paths from a French invasion.
If you invade by declaring war on Spain, then Spain is a hostile power, which it sounds like you have done. In this instance, it is like invading any other nation. The power is hostile, but you can gain a peace where you can take some regions in a peace if you wish. Otherwise, you can suppress the Spanish state, but you cannot make it a new ally as you can the Rhine Confederation or Poland.
In my understanding, the primary course you should follow is to enter Spain as an ally and then attack Portugal to deny it to Britain. This game is very open to alt-historical play. But if you goal is to gain a Franco/Spanish long term alliance as in history, do not declare war upon Spain. Instead, keep your alliance. Send a force to assist and aim to take Gibraltar and Lisbon. In this way, Spain remains an ally. You will have rebels when Britain intervenes on the peninsula, but that is the cost of supporting an ally.
Not sure this helps, but my suggestion for now.