The Spaniard completed the triangle by playing in the Brazilian, who finished off with the fourth touch of the move.
The match was Real Madrid's game in hand following their involvement in the 2017 Club World Cup, and the victory ensured that they would close the gap on second-placed Atletico Madrid to seven points.
Spanish winger Lucas Vazquez pulled the champions back into the game five minutes later by latching on to a backheel by Casemiro and arrowing his finish into the far bottom corner.More news: Larry Nance Jr. reveals his father's advice for Dunk Contest
More news: OAR Claim Bronze in Mixed Doubles Curling
More news: 'Moral Compass' Asma Jahangir Laid to Rest
Unai Bustinza gave the hosts a shock lead after just six minutes, profiting from some bad defending.
The visitors had a super chance to take the lead in the 16th minute when Lucas freed Marco Asensio in a risky position, but the Spain global could only strike into the body of Cuellar.
Ramos' evening took a turn for the worse when he collected his fifth booking of the season after tangling with Nabil El Zhar, a caution which will keep him out of Saturday's clash with Alaves.