Croatian forward Duje Cop volleyed the hosts into the lead on 14 minutes, only for Real - who made some nine changes from the midweek Champions League win over Bayern Munich - to hit back quickly when midfielder Isco smashed the ball into the top corner.
Mikel Vesga's looping header put Sporting, who started the day five points adrift of safety, back in front at the start of the second half.
Zinedine Zidane's men, though, where level again just before the hour when Alvaro Morata nodded in at the back post.
Just when it looked like Sporting would hold on for a point, Isco drilled a low shot into the bottom left corner from the edge of the penalty area.
Real coach Zinedine Zidane said: "In football luck doesn´t come in to it, there´s a lot of hard work and effort that goes in to every game. You make your own luck. With the squad that we have we can cause problems for any team. It´s in our DNA to fight until the end at Real Madrid and we´ve done that today.
"I'm happy, more than anything because we played well from the first to the last minute. They had two chances and scored two goals, we created a lot of chances. We deserved the result".