EDINBURGH — The ghost of the doomed Mary, Queen of Scots, might have been swirling in the (fake) mist above the ruined castle where she was born five centuries ago; and the plaintive bagpipes could have been in honor of Gabrielle (Coco) Chanel, when the young French woman was in love with both the Duke of Westminster and the Highlands of Scotland.

The Chanel show that Karl Lagerfeld put on last week at Linlithgow Palace, near Edinburgh, was spectacular in every sense of the word. The burning braziers, sending quivering light over old stone, and the dinner held in a tented space, arising like magic on the hillside, were outshone only by an exceptional collection.

The exquisite detail of medieval hair melded with African braids, of tweeds elongated into winter coats and of ethereal white dresses, full sleeved blouses and regal ruffs, made this one of the finest shows the designer has created in his tenure at Chanel, which hits 30 years in 2013.

“The queen of Scotland and the queen of fashion,” said Mr. Lagerfeld, as if it were so easy to take elements from the court and the clans of Scotland in the 16th century, streamlined modern sportswear and a whiff of Punk and send them out into the frosty night air, where fiery sparks competed with gently drifting snowflakes.