Titian's masterpiece Diana and Callisto has been saved for the nation in a £45 million deal.
The oil painting, one of a series of six created for King Philip II of Spain in the 16th century, was bought after a fundraising campaign which saw the National Gallery in London pledge £25 million towards the cost of keeping it in the country.
It will remain on show with another of Titian's works, its companion piece Diana and Actaeon, and be shared between the gallery and the National Galleries of Scotland in Edinburgh.
National Gallery director Nicholas Penny said: "For more than a hundred years these two great paintings by Titian have been regarded as pre-eminent among the masterpieces in private hands in the UK.
"We have been able to secure both of them for the public, in a period of economic hardship, because of the esteem and affection that both institutions have enjoyed for many decades.
"It is a triumph for us, but also for our predecessors, made possible by today's supporters, but also by benefactors who have long departed."
The £25 million contributed by the National Gallery comes from its reserves, which have been built up over the years from bequests left by members of the public.
Contributions from the Heritage Lottery fund, the Art Fund and individual donors were also put towards the cost of buying the work.
The two paintings have been in the UK for more than 200 years and form part of the Bridgewater Collection.
Their owner, the Duke of Sutherland, sold Diana And Actaeon to the two galleries in 2009 for £50 million - a sum significantly lower than the market price.
He gave them until this year to raise a similar amount to buy Diana And Callisto before agreeing to reduce the asking price by £5 million.
The painting will go on show in London for 18 months from today and then be displayed in Scotland for a year before settling into a display cycle which will see it shared by both establishments.
John Leighton, director-general of the National Galleries of Scotland, said the risk that the money might not be raised and the painting would be sold overseas was "a very real one".
He said: "For us in Scotland this has always been about a battle to hold on to what I would describe as our triple AAA status as a great art collection".
Both paintings will form the centrepiece of a special display in Edinburgh to coincide with the 2014 Commonwealth Games.
Mr Leighton added: "From today these great paintings belong to the British public and we could not be more thrilled that they will be available for the enjoyment, the education, and the inspiration for generations to come."
Culture Secretary Jeremy Hunt said the announcement was "great news".
He said: "Diana And Callisto is a breathtakingly beautiful work of art and I am immensely grateful to everyone who has helped to keep it and its companion painting Diana And Actaeon in the UK in perpetuity."