Two important points on that, first if you have your residence card, there are certain conditions that regulate the fact of you staying. I will suggest you to check your situation with the human resources people in your company. (remember that these things are more openly talked than in the States). If you company is bigger than 500 employees in Spain the must have a Union representative, he can assist you in finding counseling.

If your company is paying social security charges for you, you are eligible for "paro" benefits, the only problem is that with less than a year working in the company they are small.

In any case, get legal assistence, remember that spanish labor law tends to favor the worker, so even if fired you shouldn't have problems in extending you residence provided that you have correctly adviced in the way to proceed.