Madrid, seeking an immediate response to their demoralising 2-0 home defeat to Barca in 'El Clasico' last weekend, created chance after chance but were made to sweat before recording their seventh successive away win.
Almeria shocked their big-spending visitors by taking a 14th-minute lead through Albert Crusat, but a fine Cristiano Ronaldo goal drew Madrid level nine minutes later and Rafael van der Vaart secured the victory in the 69th minute.
Real coach Manuel Pellegrini said afterwards: "We had a good game in many respects. The team have recovered psychologically, especially after the defeat of last Saturday, and we had a much more elaborate display. We missed six or seven goals, but [Diego] Alves was very prominent. I am happy with the team.
"With the score at 2-1 we had the three points we needed. During the 90 minutes we could have scored more goals, but ultimately we did not want to concede a goal and we closed a little more at the back."
Pellegrini also stated that both Real and Barca still have difficult games ahead and anything can happen before noting that he isn't worried about his own future at the club.
"The three points were very important. We must continue pressing Barca. We both have very difficult games as Almeria have shown. We will fight every Sunday to keep adding points and to pressure Barca. Next comes Valencia and it will be very difficult to win the game. Regarding my future, I repeat, I am not worried."