From Mechanics
Resolving vertically upwards,
Tcos30
+S−mg=0
where S is the spring force which we assume is upwards.
This gives
S=mg− Tcos30
=40
9.8−90
0.866=314 N
As S is positive this means the spring is pushing upwards on the mass and thus the spring is in compression. (If S had been negative the spring would have been pulling downwards on the mass and thus would be in tension).