The piece had been bought by James Stunt, the son-in-law of Formula 1 magnate Bernie Ecclestone, but an export ban was imposed in 2013 to try to keep the painting in the UK.
The painting was offered to the NPG for £10 million, £2.5 million less than its price on the open market. The sum was reached via several major donations, including from the charity Art Fund, which gave £500,000.
The Dutch Sir Anthony Van Dyck was court artist for King Charles I in London, who had granted him a £200 salary, a knighthood, and a gold chain.
One of only three self-portraits painted by Van Dyck during his time in London, the piece sold for £8.3 million in 2009, almost three times its presale estimate.
Follow Artnet News on Facebook:
Want to stay ahead of the art world? Subscribe to our newsletter to get the breaking news, eye-opening interviews, and incisive critical takes that drive the conversation forward.