A painting previously attributed to Spaniard Salvador Maella is now thought to have been painted by his better known contemporary Francisco de Goya.
Months of tests revealed the artist's true identity (photo: La Opinion de Malaga)
The painting of the Virgin Mary, called Inmaculada or The Immaculate Virgin, was subjected to 10 months of tests.
A clue to the master's technique was a cat on the cloud below the Virgin.
The painting, worth around three million euros ($3.7m; £2.1m) is thought to have been painted in 1781 when Goya, aged 35, was painting similar works.
Art restorer Paulino Gimenez, from Malaga, said that "through x-rays and chemical investigation of the pigment and the canvas we have found several similarities between this painting and another Goya of the same period, in particular a so-called hidden face typical of Goya's work, a cat, which is the cloud on which the Virgin stands".
Mr Gimenez told Opinion de Malaga newspaper that details of the Inmaculada can be compared to a similar work, Asunta, painted by Goya in 1781.
"Everything suggests that both works were created by Goya at around the same date," said Mr Gimenez.
The discovery was made after painstaking work in Mr Gimenez's Malaga workshop.
It was in a terrible state when it was taken to him for restoration in January, as the canvas was damaged and had been painted over in parts to disguise its original religious nature.
Francisco de Goya is considered one of the world's greatest artists and one of the first "modern" artists.
In 2002, two small Goya paintings, Sagrada Familia (Holy Family) and Tobias y el Angel (Tobias and the Angel), were discovered by chance by an art expert at a home in Madrid.
They were bought by the Spanish government for 1.75m euros (£1.2m) each.