The Scottish SPCA move came after it faced public criticism for holding a Â£600,000 stake in Royal Dutch Shell.
Shell has admitted experiments on animals including rabbits, rodents, birds and fish.
The Scottish SPCA said it had sold the shares following "a full review" of its investment portfolio.
The charity had argued that most of its shares in Shell had been donated by supporters - but did admit to buying some shares back in 2005.
Figures published on Shell's website show the firm was involved with laboratory experiments on more than 100,000 animals in 2015.
Critics had accused the charity of dragging its feet on the issue, which was brought to its attention by journalists in November last year.
In a statement, Scottish SPCA Ch Supt Mike Flynn said: "We are committed to best practice in relation to the assessment of appropriate ethical standards for investment in stocks and shares.
"Following a full review of the society's investment portfolio the shares we held in Royal Dutch Shell have been sold.
"The Scottish SPCA does not invest in any companies who carry out animal testing for cosmetic purposes.
"We accept that some animal testing is required for regulatory reasons, or for the development of drugs for the purpose of treating life threatening and debilitative diseases in animals and humans."
He added: "The society will not invest in companies that use wild-caught animals as part of their testing process.
"Where animal testing is required for regulatory purposes all testing facilities used must be accredited by a recognised body.
"We strongly support the humane animal research guiding principles of replace, reduce and refine."
Scotland's largest animal welfare charity has sold its investments in an oil company that tests products on animals.