In a quiet corner of north-east Madrid, past the tattoo parlour, round the corner from the post office and near the Latin American grocery, a masterpiece of medieval craftsmanship is bathed in February sunlight for the first time in centuries.

Above the chancel of Santa María la Blanca, a small, bustling parish church in Canillejas, sits an ornate wooden ceiling of stars and leaves that is among the finest, and oldest, in Spain.

The coffered ceiling, carved in the mid-16th century in the Mudéjar style, was hidden under a plaster vault for hundreds of years, but has has been returned to its original, magnificent state following a nine-month restoration project.

Although the original ceiling was discovered more than 20 years ago by an architect relative of one of the parish’s priests, work to restore it began only last year when the Madrid regional government signed off on the €375,000 (£312,000) effort.

The plaster ceiling being stripped back to reveal the original. Photograph: Jesús Caramanzana

Ignacio de la Vega, the architect who led the project, recalled his excitement as the team sank exploratory holes into the plaster over the altar.

“What we saw was a wonderfully carved wooden ceiling with eight-pointed stars and overlapping scales on the rafters,” he told the Guardian.

“It was also in a really good condition. You see this kind of thing in Andalucía and in Castilla-La Mancha and Castilla y León, but not really in Madrid.”

He said the ceiling would probably have been plastered over as protection against the plague.

“It would have been covered up during one of the European pandemics,” De la Vega said. “A lot of sick people were brought into churches and people thought that the disease wouldn’t spread if you covered everything and whitewashed everything. That happened in a lot of churches and what was underneath was forgotten for centuries.”

Restorers working on the intricate wooden design. Photograph: Jesús Caramanzana

His team also uncovered and restored a long-lost window that lets in the sun, and a decorative layer of shields and other motifs that runs beneath the ceiling.

They, however, are not the only treasures of the church, the oldest section of which dates back to the late 15th century. Another carved wooden ceiling, albeit rather simpler, remains buried in plaster over the nave.

“This church is just a jewel,” said the architect. “This is the only complete, surviving example of a latticework wooden ceiling over both the altar and the nave in Madrid.”

The artistry, he added, is testament to Canillejas’ geographical importance. These days, the neighbourhood is best known as the barrio of El Yiyo, the matador fatally gored in 1985 [paywall], and as a meeting place for thirsty football fans on their way to Atlético Madrid’s Wanda Metropolitano stadium.

But it was also once a village halfway along the road from the city of Alcalá de Henares to Madrid, making it a place where important people would break the journey – among them St Teresa of Ávila.

This is the only complete, surviving example of a latticework wooden ceiling over both the altar and the nave in Madrid. Photograph: Fotografía y vídeo Carrera SL/Jesús Caramanzana

Marta Rivera de la Cruz, Madrid’s regional culture minister, visited the church on Wednesday, declared it “a 16th century jewel”, and said she hoped the restoration would bring in visitors from other parts of the area and beyond.

According to José Crespo, the current parish priest, word has already got out. For the past few months, visitors from across Spain and overseas have been descending on the church, keen to see it famous ceiling. After decades of anonymity, Canillejas is creeping back on to the map.

Father José welcomes the visitors – as do his proud parishioners. Few, however, can compare with the nun and mystic who is thought to have stopped into the church on more than one occasion.

“St Teresa was here,” said the priest. “What really moves me is that she was here and she would have seen this same ceiling we’re seeing today.”