Luis Suarez looked to have breathed new life into the title race when he headed home the opener from Neymar's free-kick eight minutes into the second half.
Zidane’s son scores on debut in Real Cup rout
Neymar and Lionel Messi then passed up huge chances to add to Barca's advantage, and the hosts were made to pay when Real captain Ramos met Luka Modric's free-kick with a powerful header to stretch Madrid's unbeaten run in all competitions to 33 games.
Before kick-off both sides came together to pay homage to the 71 victims that wiped out almost the entirety of Brazilian side Chapecoense's squad in a plane crash in Colombia earlier in the week.
However, once the action got underway old hostilities were renewed as Madrid screamed for a penalty less than two minutes in.
Barcelona desperate to break Real Madrid's unbeaten streak
Lucas Vazquez went down under Javier Mascherano's challenge, but referee Carlos Clos Gomez waved play on.
Barcelona enjoyed the majority of possession, but with captain Andres Iniesta left on the bench on his return from a two-month injury layoff, lacked the creativity to break down Madrid before the break.
Sergi Roberto's shot was deflected behind by Raphael Varane before Messi's harmless free-kick was easily handled by Keylor Navas.
At the other end the spotlight was on Cristiano Ronaldo more than ever in the absence of the injured Gareth Bale and following allegations of grand scale tax avoidance published by a series of European media organisations on Saturday.
The Portuguese came to life towards the end of the first-half as he had Madrid's first shot on target that was turned behind by Marc-Andre ter Stegen eight minutes before half-time and the German stood firm to deny another driven Ronaldo effort moments later.
Varane also headed straight at Ter Stegen as Madrid looked the more likely to break the deadlock as half-time approached.
However, Barca got the goal they badly needed to kickstart their title defence when Neymar's free-kick from the left found Suarez somehow unmarked to head home from point blank range.
Iniesta was then introduced to a hero's welcome and teed up Neymar for a huge chance to seal the three points 21 minutes from time.
The Brazilian skipped past Dani Carvajal, but blasted over the bar with the goal at his mercy.
Madrid substitute Casemiro then made a brilliant block to deny another goalbound Neymar shot.
Iniesta produced a sublime pass to lay the chance Messi had been waiting for all afternoon on a plate, but the Argentine pulled his effort wide of the far post with just Navas to beat.
And Barca were made to pay for their profligacy as Ramos rose unmarked to power home Modric's free-kick as the game entered stoppage time to silence the Camp Nou.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ