I am trying to shutoff the hot and cold water to the sink to replace the faucet. But the moment I slightly turn the valve to close, the water sprays all around the valve. When I open it, the splash of water stops, and there is no leaks. I live in a condo, where there is only one main shutoff valve for every four units. what can I do without shutting off the main water supply.
Globe/gate valves will often do this if they are not completely opened or completely shut. A loose packing nut can also cause this - have you tried tightening the screw/nut on it?
If it continues to be a problem I'd recommend replacing it with a ball valve (1/4 turn opens or shuts the valve).
I've had shutoff valves that do that. The ones I've encountered that do it emit water in any position than fully open or fully closed. So, if it fully shuts off, despite the leaking while you're turning it, you may be good to go.
In the one case where it leaked when fully open, the plumber I called found that the compression joint wasn't completely tight. A couple turns to tighten that fixed the problem. Otherwise, you might need to replace the valve.