In Portugal it is legally possible for same sex couples to get married. The requirements are just the same as for any other civil wedding. If the country of your nationality does not allow same sex weddings, then, instead of the marriage capacity certificate, we will need a statement from your country declaring that same sex weddings are not permitted. Usually we get this statement through the embassy of your country in Portugal.
The wedding is valid and recognized in any country that allows same sex weddings.