- Federico Valverde (46')
- Joselu (60')
- Ander Barrenetxea (5')
(Adds Valverde, Joselu quotes)
Carlo Ancelotti's side maintained their perfect league run to reach 15 points, two clear of second-placed Barcelona, who crushed Betis 5-0 on Saturday.
Real Sociedad took the lead after just five minutes as former Madrid player Take Kubo found Ander Barrenetxea in the centre of the box to score at the second attempt as keeper Kepa Arrizabalaga made a superb save but could not prevent the goal on the rebound.
Federico Valverde levelled the score in the opening seconds of the second half with a fierce shot from the edge of the box that hit the left post and went in for his first goal of the season.
"The best thing we did was try. They had a lot of chances and the first one they had they scored," Valverde told the club's official media.
"But we always kept trying, the goal right at the start of the second half helped us to keep pushing... Whatever I can do to contribute I'm happy."
Joselu then earned the lead for the hosts with a towering header from a Fran Garcia cross from the left in the 60th minute.
"Any team in the league can hurt you, we have to correct things because we conceded a goal very early on," summer signing Joselu said.
"But this is at the Bernabeu (Stadium) and with our fans we were able to turn it around.
"The goals that I score and help the team to earn points, that's what makes me the happiest."
Real Madrid kick off their Champions League campaign when they host Union Berlin on Wednesday before visiting Atletico Madrid for their league derby. (Reporting by Janina Nuno Rios in Mexico City; Editing by Hugh Lawson)
- César Soto Grado