S&P cuts Spain credit rating to near junk