Exhibit 5.1 BGC PARTNERS, INC. September 2, 2021 BGC Partners, Inc. 499 Park Avenue New York, New York 10022 Ladies and Gentlemen: I am the Executive Vice President and General Counsel of BGC Partners, Inc., a Delaware corporation (the “Company”). In connection with the Registration Statement on Form S-8 (the “Registration Statement”) filed by the Company with the U.S. Securities and Exchange Commission (the “Commission”) on the date hereof, relating to the registration under the Securities Act of 1933, as amended (the “Securities Act”), of the offer and sale of up to 1,000,000 shares (the “Shares”) of Class A common stock, par value $0.01 per share (the “Class A Common Stock”) pursuant to the BGC Partners, Inc. Deferral Plan for Employees of BGC Partners, Inc., Cantor Fitzgerald, L.P. and their Affiliates.(the “Plan”), you have requested my opinion with respect to the matters set forth below. For the purposes of this opinion letter, I, or attorneys working under my direction (collectively, “we”), have examined the Registration Statement and the originals, or duplicates or certified or conformed copies, of such corporate records, agreements, documents and other instruments, including the Restated Certificate of Incorporation, the Amended and Restated Bylaws of the Company and the Plan, and have made such other investigations as we have deemed relevant and necessary in connection with the opinions set forth below. As to questions of fact material to this opinion letter, we have relied, with your approval, upon oral and written representations and certificates of officers and other representatives of the Company and certificates or comparable documents of public officials. In making such examination and rendering the opinions set forth below, we have assumed without verification the genuineness of all signatures, the authenticity of all documents submitted to us as originals, that all documents submitted to us as certified copies are true and correct copies of such originals, the authenticity of the originals of such documents submitted to us as certified copies, and the legal capacity of all individuals executing any of the foregoing documents. We have also assumed that any Shares to be offered and sold from time to time will be duly authorized and issued in accordance with the Restated Certificate of Incorporation and the Amended and Restated Bylaws of the Company, the authorizing resolutions of the Board of Directors of the Company or a committee thereof and applicable law, and that any certificates evidencing such Shares will be duly executed and delivered, against receipt of the consideration approved by the Company, which will be no less than the par value of the Class A Common Stock on a per share basis. Based upon the foregoing, and subject to the qualifications, assumptions and limitations stated herein, I am of the opinion that, when the Shares sold have been issued, delivered and paid for in the manner contemplated by and upon the terms and conditions set forth in the Plan, the Shares will be validly issued, fully paid and nonassessable. I am also of the opinion that the provisions of the written documents constituting the Plan are in compliance with the Employee Retirement Income Security Act of 1974, as amended (“ERISA”). My opinion expressed above is exclusively based on the Plan as constituted as of the date hereof and on the requirements of ERISA in effect as of the date hereof. I am a member of the bar of the State of New York, and I do not express any opinion herein concerning any law other than the laws of the State of New York, Title I of the ERISA and the Delaware General Corporation Law (including the statutory provisions, all applicable provisions of the Delaware Constitution and reported judicial decisions interpreting the foregoing).
I hereby consent to the filing of this opinion letter as Exhibit 5.1 to the Registration Statement. In giving such consent, I do not thereby admit that I am in the category of persons whose consent is required under Section 7 of the Securities Act, and the rules and regulations of the Commission promulgated thereunder. Very truly yours, /s/ Stephen M. Merkel Stephen M. Merkel Executive Vice President and General Counsel [Signature Page to Opinion Letter of Form S-8 re: BGC 401(k) Plan, dated as of September 2, 2021]