Barca had the chance to inflict a third consecutive defeat on their rivals and increase the pressure on Zinedine Zidane.
"You always have bad spells in a season and hopefully this one only lasted a week," said Ramos. "To win in the home of your oldest rivals is always satisfying."
This was Ronald Koeman's first Clasico as Barcelona coach and some of the pressure Zidane would have felt from a loss is now transferred to the Dutchman, who has overseen only three wins from his first six games in charge.
Mundo Deportivo had declared the match "The least Clasico of Clasicos" on its front page on Saturday morning.
Yet a dip in quality does not have to mean a drop in drama and any doubts about the thrill of this fixture were answered in eight minutes, as both teams had scored.
But within three minutes, Barcelona were level. Messi, from almost left-back, chipped a ball over the top freeing Jordi Alba, who fired into the front post where Fati had nipped ahead of Ramos and turned in.
Their momentum was checked by Lenglet's error, a tug in the box clear enough that Ramos' shirt was stretched, even if the fall was comical. Referee Juan Martinez checked the monitor. Ramos found the corner.