Brazilian defender Roberto Carlos drilled a 20 metre shot low into the corner on the hour, but Real were made to work hard for their victory by a resiliant Malaga, and a demanding crowd who whistled every error.
With midfielder Thomas Gravesen suspended Guti returned to Real's starting line up, as did Michel Salgado who made an early return from a knee injury.
Real were unable to make much headway in the first period and as Malaga soaked up the pressure the crowd grew ever more frustrated. Vanderlei Luxemburgo's side were whistled off at half time after hardly troubling Francesc Arnau's goal.
Real showed more purpose after the break and Ronaldo was denied in a one-on-one with Arnau soon after the re-start.
Malaga defender Fernando Sanz almost silenced the Bernabeu with a diving header but his effort skimmed over the bar.
Malaga continued to threaten and Sanz almost caught out Iker Casillas with a dipping free kick.
Roberto Carlos finally found a gap on the edge of the area and angled a low shot into the far corner of Arnau's goal to settle the home side.
Ronaldo headed over as Real pressed in search of a second and David Beckham set up Albert Celades for a great chance but the substitute fired against the post from 12 metres.
VALENCIA CRUISE
Valencia made short work of Getafe as they strolled to a 3-1 win that put them up to fifth and back in the hunt for the European places.
Francisco Rufete, Marco Di Vaio and Mista all scored for Valencia before Mariano Pernia pulled one back for the visitors.
Sevilla striker Julio Baptista ended his side's five-match winless run from the penalty spot, then got sent off, as the Andalucians beat struggling Real Mallorca 1-0.
Mallorca midfielder Gonzalo de los Santos brought down Baptista in the area just before halftime, earning himself his second yellow card of the game, and Baptista got up to score his 14th goal of the season.