PSD member of parliament Teresa Leal Coelho also voted in favour of changing the law, go against the party whip.
The vote was applauded in the session and by citizens attending in the galleries.
According to a count by the Assembly of the Republic, 109 votes were in favour compared to 106 against.
The final bill, which was put forward by the Government, BE and PAN parties, will allow people aged over 16 to change their gender and given names in the civil registry, on request and without the need to present a medical report .
Between the age of 16 and 18, this procedure must be authorized by the legal guardians.
The bill also prohibits, "except in situations of proven health risk," surgical or pharmacological interventions involving changes in the body or sexual characteristics of intersex infants and children.