There is not a consensus among the Schengen States regarding persons in your situation.
To some Schengen states, the time covered by a D visit in any Schengen country (Sapin for instance) does not count and, as a Mexican, you are still exempted from a short stay visa if you visit another Schengen country (such as France). I understand France is on that line. But I would advise you to check beforehand with the French consulate in Madrid or if you intend to go to Greece, to the Greek consulate.
Now, regarding your reentry in Spain, I do not know. France issues multiple entry visas to persons in your situation to avoid the problem. You should check with the Spanish authorities.