Barcelona produced a performance full of verve and skill, with midfielder Ilkay Gündogan opening the scoring from close range in the sixth minute by taking advantage of a bad defensive mistake by the visitors.
However, Barca were punished for failing to convert their dominance into goals as Bellingham made the most of the two chances he had in the second half.
First he unleashed an unstoppable strike from range into the upper left corner in the 68th minute and then, in stoppage time, he scored the winner after collecting a Luka Modric pass inside the box.
Madrid are top of the league on 28 points, level with Girona. Barca are third on 24.