The institution in Aberystwyth agreed a deal by private treaty for an undisclosed amount ahead of the scheduled sale at Rogers Jones in Cardiff on October 19. It was due to be offered with an estimate of £40,000-60,000.
The 15 x 13in (36 x 33cm) picture was painted in 1909 and is the second version of Vosper’s watercolour, gouache and wash depicting Sian Owen in traditional Welsh costume arriving at her pew in Capel Salem, Cefn Cymerau baptist chapel in North Wales. The primary version of this image celebrating the Welsh religious revival is in the Lady Lever Art Gallery in Port Sunlight.
The picture became a well-known image in Wales partly because the Lever Brothers' company used it in promotional campaigns for its Sunlight Soap.
Pedr ap Llwyd, chief executive and librarian of the National Library of Wales, said: “This enigmatic work by Sydney Curnow Vosper is one of the nation's treasures and I look forward to sharing it with the people of Wales and beyond.”
The library will share it with the community as part of its Masterpieces in Schools program.
Ben Rogers Jones of Rogers Jones auctioneers said: “I would like to thank the National Library of Wales for their expediency in agreeing the sale. I will be looking forward to seeing Salem in its new home in Aberystwyth.”
Meri Huws, vice president of the library, said: "This priceless treasure could have easily been lost by the nation and this would have been a great travesty. Over the years the Library has collected works of art that portray Welsh life and this painting will enhance our excellent and extensive collection of Welsh artwork.”