Madrid captain Ramos was substituted in last week's home defeat to Cadiz and missed the subsequent shock reverse against Shakhtar Donetsk in the Champions League as the Spanish champions crept towards a crisis ahead of their first meeting with Barca this season.
But the centre-back was fit to start for the crunch LaLiga clash at Camp Nou and drew a second-half spot-kick from Clement Lenglet to restore Madrid's lead after Ansu Fati had cancelled out Federico Valverde's opener in a frantic start.
Luka Modric then preyed on a Neto error in the 90th minute to secure the points and take Zinedine Zidane's men top, earning back-to-back LaLiga wins against their fiercest rivals for the first time since May 2008 - the last time they successfully defended their domestic title.