With Gareth Bale out for the second straight game and Cristiano Ronaldo strangely subdued, Di Maria capped a productive night with a goal from another deflected shot in the 73rd. It came just after Luka Modric cleared Diego Godin's header off the goal-line for Atletico's lone scoring opportunity.
Madrid has yet to concede in eight domestic cup matches this season.
"Everybody was fantastic, we did everything very well," Madrid coach Carlo Ancelotti said after Madrid took a page out of Atletico's book and played with his pressure to keep the visitors from getting any time on the ball. "We showed we can excel in these types of contests."
Atletico's first defeat since October came three days after it took over the league league lead outright for the first time since 1996.
"We didn't come through and play the kind of game we wanted to. It's unfortunate but there is still the return leg," Atletico midfielder Koke said.
Sociedad's intentions were clear as the Basque side sat back and tried to weather Barcelona's pressure and strike on the counter, but goalkeeper Jose Manuel Pinto kicked Carlos Vela's shot as the Sociedad striker managed an attempt with Javier Mascherano dragging him to the ground.
Sociedad goalie Enaut Zubikarai did well to deny Cesc Fabregas and Lionel Messi before watching a ball skip through the area onto the foot of Sergio Busquets to bounce inside the post in the 44th.
Sociedad was reduced to 10 men after Inigo Martinez was shown his second yellow card for protesting the goal.
Barcelona exploited the extra space as Alexis Sanchez was played clear into the area in the 60th but shot off the post, with Gorka Elustondo mystifyingly clearing the loose ball back into the area where it came off Zubikarai into goal.
Like Ronaldo, Messi was also muted until Zubikarai saved his leaping volley effort near the close.