The forces acting on the block:

The acceleration of the block is zero and so, the sum of the forces exerted on the block is zero:
It follows from this equation that the magnitude of the force of the spring must be equal to the magnitude of the gravitational force.