No matter how much money Real spends on new strikers, Raul continues to be first-choice.
Just four minutes later, Deportivo forward Riki made it 1-1 by heading in a free-kick from Juca.
In the 34th minute, Raul was pulled down by the nervous Aranzubia, and Ronaldo made it 2-1 from the penalty spot.
Without suspended Pepe and injured Christoph Metzelder, Real looked edgy in defence, and Deportivo veteran Juan Carlos Valeron scored his team's second goal straight after half-time after being put through by Andres Guardado.
Valeron missed an excellent chance to make it 3-2 to the visitors, who were punished for their naivety on the hour when Diarra hit the winner.
Fielding no less than seven new signings, Real just about deserved their win, though they were begging for the final whistle at the end.
The game was watched by sprinter Usain Bolt, who received a warm welcome from the Madrid crowd.
Later Saturday, Zaragoza beat fellow newcomers Tenerife 1-0 on a late goal from Javier Arizmendi, who was their top scorer last season in the second division.
Defending champions Barcelona kick off their Liga campaign Monday at home to Sporting Gijon. They will be without star striker Lionel Messi, who left to prepare for next week's Argentina-Brazil clash straight after Friday's 1-0 defeat of Shakhtar Donetsk in the UEFA Super Cup.