I am Brazilian and my husband is French. We are living in Spain currently. I entered in Europe as a tourist. I could stay 90 days as a tourist and it's over, my situation is illegal right now. We try to make my papers here in Spain and it did not work. Then we tried France and it did not work neither. The only option for me is going back to Brazil and ask my visa in the french consulate which is not going to fix my situation in Spain but it does not matter anymore because we are going to live in France soon. What I am afraid of is: I bought my air ticket Barcelona/Brazil/Barcelona. When I arrive back in Barcelona they can deny my entering? Will they accept my french visa?
Formally, Spain is supposed to honor Schengen visa granted by France and allow visits from people residing in France but they could still refuse entry, e.g. if they have doubts about the purpose of the stay or, I guess, your intent to go to France (actually, even France can deny entry to the holder of a French visa, it would be unusual but the visa does not guarantee you will be admitted). Your pretending to be a tourist and having stayed in Spain longer than you should in the past will look suspicious in that respect.
It would be nasty for them to do that in your case given the fact that as the spouse of an EU/EEA citizen you enjoy a lot of rights within the European Union and could in principle get a residence permit (i.e. you are not quite in the same situation as someone with a short-term tourist visa or even as a French resident without a French spouse) but I do remember hearing about some issues in the past (don't remember the specifics unfortunately) so you certainly want to be careful.
On the other hand, if you do want to reside in Spain even for a short time, then you need to apply to the Spanish authorities. Same thing if you want to stay there for more than three months (the three-months-in-a-six-month-period rule also applies to non-EU residents of a Schengen country visiting other Schengen countries). Under EU law, you are entitled to a right of residence but this is left to each individual member state to implement so the details of what you need when traveling will depend on Spanish law. This is a consequence of your husband's freedom of movement within the EU and therefore unrelated to Schengen or to the rights enjoyed by other non-EU/EEA residents of France or to the French “long séjour” visa. As you already found out yourself, the fact that you are in principle entitled to stay in Spain does not mean you can enter as a tourist and sort it all out later.
If that's at all possible, I think traveling through France with your sponsor (i.e. your French husband) could make things easier/safer. Your visa will require you to go there relatively quickly anyway. Alternatively, you could ask the Spanish consulate in Brazil for a visa based on the fact that you want to join your husband in Spain (I think that would have been the most proper course of action from the beginning) but this could involve a lot of paperwork first to obtain a residence permit and then to transfer that right to France when you move there.