Real went top with the 1-0 result.
"This is the type of game you remember at the end of the season as one in which taking the three points was essential. We're very happy. Real Sociedad are a complicated opponent and they always make things difficult for us at Anoeta," said Ramos.
"We won't always win with the large leads of our latest games. Our opponent tonight pushed on, especially in the second half, and the match leaves a very good aftertaste."