The visitors had the first meaningful opening of the match in the 15th minute when Oscar Trejo's drive had to be pushed over the crossbar by Iker Casillas.
Despite chances for the home side through Pepe and Marcelo, Gijon were awarded a penalty with half an hour played after Sergio Ramos had handballed. Miguel de la Cuevas stepped up to fire the visitors into a shock lead.
However, Madrid were level at the break as Gonzalo Higuain tapped in from six yards from Ramos's cross.
Jose Mourinho's side pushed hard to take the lead after half time, but Higuain and Cristiano Ronaldo both squandered chances as Madrid were frustrated.
It took Los Blancos until the 74th minute to get their noses in front as Ronaldo powered in a header from substitute Angel Di Maria's teasing cross.
Gijon's night got worse in the 79th minute when Roberto Canella picked up his second yellow card for a risky challenge on Di Maria.
Madrid made their numerical advantage count almost instantly as substitute Karim Benzema collected Mesut Ozil's pass before guiding the ball home.