Dating from the late 18th century, Edinburgh Milkmaid With Butter Churn by David Allan shows a woman going about her work in an Edinburgh street.
The watercolour, described as “rare and extraordinary” by experts, is unusual because it shows her alone and centre stage at a time when black sitters more often appeared as marginal figures in group portraits.
The woman’s name and life story is not known.
Christopher Baker, director of European and Scottish art at the National Galleries of Scotland (NGS), said: “We are so pleased to bring this remarkable, rare and extraordinary watercolour into Scotland’s national collection.
“It is an incredibly striking and special work, one which we believe will be enjoyed by many and, we hope, lead to new research on its background and most importantly the story of the woman depicted.”
The image is dated to the mid-1780s to early 1790s, a period when Allan created evocative drawings of ordinary people going about their daily lives in Edinburgh, such as soldiers, coalmen, fishwives, sedan chair porters, firemen and officers of the city guard.
The series of more than 20 drawings of workers and traders were known as his Edinburgh Characters.
Edinburgh Milkmaid With Butter Churn will go on display at a later date following some conservation work.
The painting was acquired from an art dealer, having been in a private collection for many years, and has never been on public display as far as NGS knows.
With much still unknown about the painting, NGS said it will welcome information, comments or feedback about it.
It is hoped that further research may reveal more about the connection between the artist and the young woman in the painting and shed some light on her identity.
NGS said Alloa-born Allan was arguably the first Scottish artist to take contemporary life and customs from across the social hierarchy as a subject worthy of art.
With the support of his patrons, Lord and Lady Cathcart of Shaw Park, near Alloa, he travelled to Italy around 1767 and became interested in drawing street life scenes.
These experiences inspired him to take a similar approach after he returned to Scotland in 1779 and he drew on contemporary life for his subject matter.