The blaze started late on Friday night at Burro Canaglia Bar&Resto, an Italian restaurant in the central neighborhood of Salamanca, Reuters reported.
An eyewitness told El Pais newspaper that the fire started after a waiter was flambéing a dish and the flames set fire to the ceiling and walls.
Diners struggled to flee as the blaze started near the main exit, emergency services said.
Spanish police are investigating the cause of the fire.