The Italian coach admitted his side were made to "suffer" in their 1-0 win on Sunday but stressed they are primed for the Clasico showdown next week
Cristiano Ronaldo's solitary strike at La Rosaleda was enough for the Liga leaders to stretch their unbeaten league run to 18 matches.
Malaga played their 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 defence throughout the 90 minutes and restricted the hosts' opportunities in front of goal.
"The match was very difficult because Malaga pushed hard," he told reporters. "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 Madrid head into next weekend's encounter with Barcelona in buoyant mood, and Ancelotti says his side are well prepared for the showdown.
He added: "We had a great attitude and are ready to play the Clasico."