Yes, with a NIF. Every car purchase in Portugal is recorded in the vehicle register (registo automóvel) in the buyer's name, and that requires a Portuguese tax number (NIF). Non-residents can get a NIF from the tax authority (Autoridade Tributária), usually with a fiscal representative.
The ownership registration is filed with the IRN, online (Automóvel Online) or at a registry office, often by the dealer. The car's documents are the Documento Único Automóvel or, for newer cars, the Certificado de Matrícula.