If I used a last name different from the one on my birth certificate is my marriage legal?
The answer will depend on the nature of the mistake and local procedures. It is possible that you've legally changed your name since the birth certificate was issued. If the other spouse was unaware of the true identity of the person they married, it may be grounds to void the marriage. If it is a minor typographical error, it may be possible to obtain a corrected marriage license. I suggest calling the clerk where the marriage license was issued.
The following is a NY statute related to marriage licenses:
§ 16. False statements and affidavits.
Any person who shall in any affidavit or statement required or provided for in this article wilfully and falsely swear in regard to any material fact as to the competency of any person for whose marriage the license in question or concerning the procuring or issuing of which such affidavit or statement may be made shall be deemed guilty of perjury and on conviction thereof shall be punished as provided by the statutes of this state.