Los Blancos trailed after Largie Ramazani’s sixth-minute strike, with Almeria holding the lead until the second half.
Lucas Vazquez leveled for Real just after the hour mark, with substitute David Alaba scoring with his first touch, a 74th-minute free-kick, for the winner.
“The younger lads didn’t play like they usually do but I’m pleased with them,” Ancelotti said.
“But on an emotional level, the game has weighed a bit on them. That is quite normal, they are very young, and the shirt weighs heavy.
“They didn’t do anything wrong but they can do better.
“I took Camavinga off because he was on a card and I didn’t want to risk it.”
“Originally, it should have been Karim or Toni taking the free-kick,” he said.
“Alaba strikes them really nicely from that side and (assistant coach) Davide (Ancelotti) told me to have him take it, which he did, and he got it right.
“It wasn’t easy to tell Karim and Toni not to have it but he took it and scored.”