Cristiano Ronaldo's solitary strike at La Rosaleda was enough for La Liga leaders Real to stretch their unbeaten league run to 18 matches.
The Portuguese settled the encounter with a clever strike across the face of goal after 23 minutes and, although they had chances to extend the lead, Real had to settle for a one-goal cushion.
Malaga played their part in frustrating Real Madrid, 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 said. "We had opportunities for a second but had no luck.
"At 1-0 there is always suffering. It was not a great match, but we (showed) defensive strength. We did not give (them) a chance. 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 Ancelotti explaining: "He has a bruised thigh and could not continue."
The win means Real head into next weekend's El Clasico 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."
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.