Real's first chance came 11 minutes into the match when the Portuguese forward picked out Isco inside the box, but the winger sliced his effort wide.
However, Marc Bertran managed to find a gap in the Madrid defence to set up Riera, who beat Diego Lopez with a powerful header to put Osasuna in front.
Modric believed that he should have won a penalty for Carlo Ancelotti's side when he tangled with Javi Arribas, but he did not get the decision from the referee.
After a quiet period from both sides, Riera managed to double the hosts' lead five minute from half time with another header, nodding the ball in from the rebound after Lopez had punched an Arribas strike away.
Things got worse for the visitors just before the break when Sergio Ramos was sent off for elbowing Roberto Torres in an off-the-ball incident.
However, Isco gave Real some hope by drilling the ball in from a Ronaldo delivery in the final moments of the first half.