Police shut down the bakery belonging to the Granier chain on Madrid's Calle Alcala in the early hours of Friday morning after several passersby recorded footage of the rats crawling around among the ‘bocadillos'.
The footage was posted on social media and quickly went viral.
Police visited the store in the Pueblo Nuevo district and confirmed that rats were still present in a display case visible from the store window.
Madrid city hall said the store would remain closed until a full health and safety inspection could be carried out.
Reports suggested that the rats were gaining entrance to the store through a gap in the front door and holes in the ceiling.
Granier said it had launched an internal investigation and would fully cooperate with authorities.
“This is an isolated incident that is being investigated internally to establish the causes. The more than 350 Granier stores in Spain and around the world strictly comply with all food health and safety standards,” said a statement issued by Granier headquarters.