I get different kinds of spasm in my calves, and different things help. One is helped by stretching, another by digging my knuckle into the specific bit that’s spasming (that triggers spasms at first, but after a while it seems to tire the muscle enough so it relaxes), and another by lying on my front with my leg and foot stretched out.
Mindfulness meditation really helps too. If you don’t know anything about it, it basically involves noticing what’s happening in the moment, and accepting it without wanting to change things or labelling anything as bad. So with the spasms, it means noticing what it feels like, but you also notice what the rest of you is feeling, what your breathing is like, what you can hear etc. You’d thing that focusing your attention on on some spasms, accepting them instead of wanting them to stop, is some kind of torture. But weirdly, it does help. I find I don’t get annoyed or distracted by them like I used to.