Bruno Cesar had sent an impressive Sporting side one goal ahead early in the second period of the Group F clash, but Cristiano Ronaldo levelled with an 89th-minute free kick against his former employers, before substitute forward Morata won it with virtually the last touch of the match at the Bernabeu.
Real Madrid boss Zinedine Zidane handed Karim Benzema his first start of the season at centre-forward, while Ronaldo, having recovered from a knee problem, started against the club that he represented between 1997 and 2003.
As for Sporting, former Fulham attacker Bryan Ruiz was selected ahead of on-loan Arsenal forward Joel Campbell, while reported Manchester United and Arsenal target William Carvalho started alongside Adrien Silva in midfield.
It was the visitors that kicked things off in Madrid and after a period of sustained possession inside two minutes, Cesar fired a low effort just wide of the Real Madrid post to send an early warning to the home team.
Sporting continued to impress as play developed, and the visitors had another half-chance in the ninth minute when Gelson Martins drove towards the Real Madrid box before testing Kiko Casilla with a low drive.
Gareth Bale provided the home side's main threat in the opening 20 minutes as he tested Rui Patricio with a low drive before delivering a cross in to Benzema, who was just beaten to the ball by the stretching Nelson Semedo.
Real Madrid took control of the possession as the first half gathered pace, but Sporting were carrying a real threat on the counter as Martins and Ruiz looked to feed Bas Dost inside the home side's box.
Ronaldo tried his luck from distance in the 27th minute after finding space outside the box, but Patricio was on hand to deny his international teammate, before Dost just failed to connect on another Martins cross down the other end.
It was Sporting that continued to look the most likely to make the breakthrough and Silva tested Casilla from distance in the 41st minute, but the Spanish goalkeeper made the save as the two teams entered the half-time break on level terms.
There was a doubt whether Bale would feature in the second half after suffering a blow to his hip in the 43rd minute, but the Welshman took to the field as Los Blancos looked to improve on what was a lacklustre first period.
It was Sporting that made the breakthrough in the 47th minute, however, when Cesar found the bottom corner with a curling effort after reacting first to a loose ball inside the home side's box.
The opening goal appeared to shock Real Madrid into life, but Sporting were still carrying a threat and Casilla had to get down to keep out another Cesar strike in the 53rd minute as the enthralling game continued to entertain.
Sporting boss Jorge Jesus was sent to the stands 30 minutes from time after arguing with the fourth official, but his team continued to create opportunities and Dost headed another Martins cross just wide in the 62nd minute.
Morata and Lucas Vazquez were introduced 20 minutes from time as Zidane looked to his bench for inspiration, but Sporting continued to close the space in the final third, with Sebastian Coates and Semedo both impressing at the back.
Morata came within inches of meeting a dangerous Vazquez cross in the 73rd minute as Real Madrid came close to levelling, but former Liverpool defender Coates was once again on hand to block.
Dani Carvajal was next to come close for Real Madrid after the Vazquez delivered another telling cross, but the right-back put his effort wide of the post as the final 10 minutes approached with Sporting still ahead in Spain.
Ronaldo then had a glorious chance to level in the 83rd minute when Vazquez found the Portuguese at the far post, but Real Madrid's record goalscorer somehow hit the post, before Carvajal found the side-netting moments later.
Real Madrid would not take no for an answer, however, and Ronaldo sent a brilliant free kick into the top corner in the 89th minute to level the scores against his former club, before Morata headed a James Rodriguez cross past Patricio to win it for the under-par hosts in the fifth minute of added time.