Cristiano Ronaldo's solitary strike at La Rosaleda was enough for the Liga leader to stretch its unbeaten league run to 18 matches.
Malaga played its part in frustrating Madrid and piled on the pressure late in the second half, and Ancelotti was thrilled with the way his side had maintained concentration in defense throughout the 90 minutes and restricted the home team's opportunities in front of goal.
"The match was very difficult because Malaga pushed hard," he said. "We had opportunities for a second but had no luck. We didn't score the second and then we suffered. It was not a great match, but we showed defensive strength. We did not concede many chances. The result is very good and important.
"You cannot always win 2-0 or 3-0. We have worked hard and I'm happy. It was not the worst game. It was not spectacular. We missed the last pass."
Striker Karim Benzema was withdrawn after 32 minutes to be replaced by Angel Di Maria, with the Frenchman set for further tests over fears he could miss the Clasico next week.
Ancelotti, however, was not too concerned with the knock, simply stating: "He has a bruised thigh and could not continue."
The win means Madird heads into next weekend's encounter with Barcelona in buoyant mood, and Ancelotti says his side is well prepared for the showdown.
He added: "We had a great attitude and are ready to play the Clasico."