BBC_ Stately home Stourhead, near Warminster, had Penelope and Euriclea by Angelica Kauffman for more than a century, until debts forced the owner at the time to sell it in 1883.
The National Trust, which now runs the property, spotted the artwork going up for auction in New York just 12 days before it was to be sold.
Visitors to Stourhead can now see the painting on display.
Henry Hoare II "the Magnificent", the creator of the Stourhead's famous landscape garden, first bought the painting in 1773.
It depicts a scene from Homer's Odyssey, showing servant Euriclea waking Penelope to bring her news her husband Odysseus had returned from fighting in the Trojan War and a ten-year journey home.
Records from 1822 show the painting was kept in the dining room by Henry's grandson, Sir Richard Colt Hoare.
But by 1883, it was sold into a private collection by Sir Henry Ainslie Hoare.
National Trust cultural heritage curator Stephen Ponder learned the painting was going to be auctioned by Christie's in May this year.
He said it was "a rare opportunity to acquire the painting for public benefit and return it for display and interpretation".
April Johnson has done some conservation cleaning before the painting goes on display
"With so little time available, I hardly dared hope that we might be able to find the funding and make a successful bid to bring the painting back to Stourhead," he added.
The National Trust said getting back objects from the 1880s sales was a priority, and with the support of a National Trust fund and a member of the Hoare family, the charity was able to secure the painting.
According to the auction house, the artwork was sold for $214,000 (just over £176,000).
Mr Ponder said seeing it for the first time was "a very exciting moment" and "one of the highlights of his career".
"I am absolutely delighted that we succeeded," he added.
The work will be on display at Stourhead until 5 November, it will then feature in a wider exploration of Kauffman's work in 2024.