Yes. Foreigners can buy property in Portugal, and there are no nationality-based restrictions.
But buying property does not give you the right to live in Portugal full-time. For example, many non-EU buyers, including Brits, are still limited by the 90/180-day Schengen rule unless they also have residency.
It is also no longer possible to qualify for Portugal’s Golden Visa through most property purchases. If you want to live in Portugal long term, you will need to get residency separately. For EU, EEA, and Swiss citizens, that is relatively straightforward. For most other nationalities, it usually means applying for a visa first.
Thinking about Moving to Portugal?