Defender Militao finally prised open the visitors by heading home from a corner in the 76th minute for his first league goal of the season.
Midfielder Casemiro made sure of the points four minutes later with a fortuitous strike when he attempted to control a through ball from Karim Benzema and sent it trickling into the bottom corner of the net, flummoxing keeper Sergio Herrera.
The win took second-placed Real to 74 points from 34 games after Atletico had moved onto 76 by riding their luck to win 1-0 at Elche earlier on Saturday. Fellow title rivals Barcelona and Sevilla are in action on Sunday and Monday respectively.
Having stayed on Atletico's heels, Real will now turn their attentions to reaching the Champions League final when they head to Chelsea in Wednesday's semi-final second leg after a 1-1 draw in the Spanish capital last week.
Coach Zinedine Zidane left midfielders Toni Kroos and Luka Modric on the bench for the whole game and turned to reserve team player Antonio Blanco, while bringing on fellow youngsters Miguel Gutierrez and Sergio Arribas in the second half.
Eden Hazard was Real's most dangerous player in an impressive first half from the hosts, who had a slew of chances to go in front.
Visiting keeper Sergio Herrera reacted quickly to repel a close-range shot from Hazard and moments later tipped a powerful Militao header over the bar before thwarting the Brazilian again later in the second half.
Osasuna did their best to keep Real at bay while offering little in attack although they had a goal ruled out for offside by Chimy Avila just before halftime.
The visitors also nearly benefitted from an over-hit backpass by Militao which forced Madrid keeper Thibaut Courtois to race towards his line and stop the ball.
Substitute Rodrygo nearly found a breakthrough out of nothing when he danced past a couple of Osasuna defenders and went for goal, pulling his shot just wide of the far post.
It took a set-piece for Real to finally take the lead, Militao meeting Isco's corner with venom to make it third time lucky and Casemiro's goal soon followed to see Zidane's side over the line.