When the Madrid museum received it from a private family in 2011, the 15th-century painting "Prayers in the Orchard" showed Jesus and three apostles watched over by God in a starry blue sky.
But when experts scanned it and then removed layers of brown paint in the bottom left corner, a bald, red-haired nobleman in a red robe was revealed, accompanied by a female saint in green.
The insignia of golden nettle leaves on his sleeves identified the man as Louis of Orleans. The woman is Saint Agnes, a patron saint associated with his family.
It is one of only a handful of surviving pictures of the duke, and the only one painted on wood, said the museum, which called it "one of the most important finds in French primitive painting".
Its fine quality and the rarity of works of its kind, many of which were destroyed in the French Revolution, make it "a little gem with great historical significance", the Prado said in a statement.
"The great value of this work is that it is really unique," said Maria Antonia Lopez de Asiain, who worked for a year with a microscope and a lancet on the restoration of the painting.
The duke acted as regent around the turn of the 15th century, standing in for his indisposed brother, Charles the Mad.
Louis was assassinated in 1407 on the orders of his cousin and rival for power, John the Fearless, Duke of Burgundy.
The museum said that the king's posture in the picture, according to painterly conventions, identified him or his family as patron of the work.
He holds a scroll inscribed with a funeral prayer, suggesting the painting may have been ordered by his family shortly after his death.
Painted in tempera on wood, the picture measures only 56 cm by 42 cm, suggesting it may have been used in a private shrine, the museum said.
The museum believes it to be the work of Colart de Laon, the duke's personal painter and valet.