The 17th Century miniature painting of Edward Herbert, 1st Baron Herbert of Cherbury, was painted in watercolour on vellum by Isaac Oliver.
It will be restored before going back on display as the star attraction at Powis Castle, near Welshpool.
It was bought for £2.1m by the National Trust with help from the National Heritage Memorial Fund and Art Fund.
The artwork shows Herbert, who was a poet, socialite and philosopher, with his head resting on his hand as he lies stretched out along the banks of a stream running through a forest.
He bears a shield with a burning heart and the painting is said to reflect his life as a chivalrous romantic.
The painting was put up for sale on behalf of a private owner but was secured by the National Trust with the help of donations.
Painted by royal miniaturist Isaac Oliver between 1602 and 1617, it measures 23cm by 19cm (9in by 7in) and is mounted on oak board in a contemporary 17th Century tortoiseshell and ebony frame.
Justin Albert, National Trust Director for Wales, said the charity was proud to retain the "incredible" painting, which was of Welsh, British and European importance.
He said the painting was fragile and would be restored before possibly being loaned to museums ahead of returning to Powis Castle.
One of the "finest" portraits of the Jacobean era has been bought so it can remain at its home in mid Wales.