The second-half substitute put Real back in front with a brilliant finish after Lionel Messi's penalty cancelled out Gerard Pique's own goal.
Ronaldo, booked for removing his shirt in the celebrations, was given his marching orders after picking up a second yellow card for diving.
The Portugal superstar then appeared to push referee Ricardo De Burgos Bengoetxea as he exited the field.
Ten-man Real extended their lead in the 90th minute through Marco Asensio, who blasted home from the edge of the box to wrap up a 3-1 victory for the defending league champions.
They will play the second leg at the Bernabeu on Wednesday.