Gonzalo Higuain struck the winner for Real and Pellegrini said: "We hit the post twice. I am happy with the three points and with our defensive security.
"It is always hard to return after 15 days.
"We suffered a tough elimination from the Copa Del Rey and the team bounced back well."
He added: "We must improve the football we play, but in other matches, playing worse, we have obtained greater scorelines. The 1-0 does not reflect what happened in the game.
"Racing did not create the slightest danger to our goal."