One Arts Plaza, 1722 Routh Street, Suite 1500 | Dallas, TX 75201| T 214.969.1700 | F 202.955.5564

Holland & Knight LLP |

Exhibit 5.1

May 19, 2023

Board of Directors
Granite Ridge Resources, Inc.
5217 McKinney Avenue
Suite 400
Dallas, Texas 75205


Registration Statement on Form S-4

Ladies and Gentlemen:

We have acted as counsel to Granite Ridge Resources, Inc., a Delaware corporation (the “Company”), in connection with the Registration Statement (the “Registration Statement”) on Form S-4 to be filed under the Securities Act of 1933, as amended (the “Securities Act”), on the date hereof by the Company, with the U.S. Securities and Exchange Commission (the “Commission”), relating to (a) the Company’s offer to exchange (the “Exchange Offer”) 0.250 shares of the Company’s common stock, par value $0.0001 per share (“Common Stock”), for each of the Company’s warrants to purchase Common Stock at an exercise price of $11.50 per share (the “Warrants”); and (b) the solicitation of consents (the “Consent Solicitation”) from the holders of the Warrants to amend the Granite Ridge Warrant Agreement (as defined below) to permit the Company to require that each Warrant that is outstanding upon the closing of the Exchange Offer be exchanged for 0.225 shares of Common Stock, in each case upon the terms and subject to the conditions set forth in the Preliminary Prospectus (as defined below) and the letter of transmittal and consent relating to the Exchange Offer and Consent Solicitation (the “Letter of Transmittal”). The shares of Common Stock issuable upon exchange of the Warrants pursuant to the Exchange Offer and the Warrant Amendment (as defined below) are referred to herein collectively as the “Warrant Shares.”

In connection with the issuance of this opinion letter, we have examined originals or copies, certified or otherwise identified to our satisfaction, of:

(i)the Registration Statement, and all exhibits thereto;
(ii)the preliminary prospectus/offer to exchange, dated May 19, 2023, relating to the Exchange Offer and Consent Solicitation (such preliminary prospectus/offer to exchange being hereinafter referred to as the “Preliminary Prospectus”), which forms a part of and is included in the Registration Statement;
(iii)the Letter of Transmittal;

Atlanta | Austin | Birmingham | Boston | Century City | Charlotte | Chattanooga | Chicago | Dallas | Denver | Fort Lauderdale | Houston | Jacksonville | Los Angeles | Miami | Nashville | New York | Orange County | Orlando | Philadelphia | Portland | Richmond |

San Francisco | Stamford | Tallahassee | Tampa | Tysons | Washington, D.C. | West Palm Beach

Board of Directors of Granite Ridge Resources, Inc.

May 19, 2023

Page 2

(iv)the Amended and Restated Certificate of Incorporation of the Company, as presently in effect (the “Certificate”);
(v)the Amended and Restated Bylaws of the Company, as presently in effect (the “Bylaws”);
(vi)resolutions of the Company’s Board of Directors (the “Board”), adopted on May 10, 2023, and resolutions of the Pricing Committee of the Board adopted on May 19, 2023, relating to the authorization for the Registration Statement, the issuance of the Warrant Shares and other related matters;
(vii)the Warrant Agreement, dated September 15, 2020, as amended on March 24, 2021, by and between Executive Network Partnering Corporation, a Delaware corporation (“ENPC”), and Continental Stock Transfer & Trust Company, a New York corporation (“Continental”), as amended and as assigned to and assumed by the Company pursuant to the Assignment, Assumption and Amendment Agreement, dated as of October 24, 2022 by and among the Company, ENPC and Continental (as so amended, assigned and assumed, the “Granite Ridge Warrant Agreement”)
(viii)a form of the amendment to the Granite Ridge Warrant Agreement (the “Warrant Amendment”); and
(ix)the Dealer Management Agreement dated as of the date hereof by and between the Company and BofA Securities, Inc.

We have examined and relied on originals or copies certified or otherwise identified to our satisfaction of such documents, corporate records, certificates of public officials and other instruments as we have deemed necessary or appropriate for the purposes of this opinion. In such examination, we have assumed (a) the authenticity of original documents and the genuineness of all signatures; (b) the conformity to the originals of all documents submitted to us as copies; (c) the truth, accuracy and completeness of the information, representations and warranties contained in the records, documents, instruments and certificates we have reviewed; (d) the Registration Statement, and any amendments thereto, will have become effective under the Securities Act; and (e) all Warrant Shares will be issued, in compliance with applicable federal and state securities laws and in the manner stated in the Registration Statement and the Preliminary Prospectus. We also have assumed that the issuance by the Company of the Warrant Shares will not violate, conflict with or constitute a default under (i) any agreement or instrument to which the Company or any of its subsidiaries is subject; (ii) any law, rule or regulation to which the Company or any of its subsidiaries is subject; (iii) any judicial or regulatory order or decree of any governmental authority; or (iv) any consent, approval, license, authorization or validation of, or filing, recording or registration with any governmental authority. As to any facts material to the opinions expressed herein which were not independently established or verified, we have relied, to the extent we have

Board of Directors of Granite Ridge Resources, Inc.

May 19, 2023

Page 3

deemed reasonably appropriate, upon statements and representations of officers, directors or other representatives of the Company.

This opinion letter is being furnished in accordance with the requirements of Item 601(b)(5) of Regulation S-K under the Securities Act.

The opinion letter which we render herein is limited to the General Corporation Law of the State of Delaware, including all Delaware statutes and all Delaware court decisions that affect the interpretation of such General Corporation Law, as of the date hereof. Our opinions expressed herein are as of the date hereof, and we assume no obligation to revise or supplement the opinions rendered herein should the above-referenced laws be changed by legislative or regulatory action, judicial decision or otherwise.

Based upon and subject to the foregoing assumptions, qualifications and limitations set forth herein, we are of the opinion that the Warrant Shares, when issued by the Company in accordance with the terms of the Exchange Offer and the Warrant Amendment, will be duly authorized, validly issued, fully paid and non-assessable.

We hereby consent to the filing of this opinion letter as an exhibit to the Registration Statement and to the references to us under the heading “Legal Matters” in the Preliminary Prospectus forming part of the Registration Statement and any supplement thereto. In giving such consent, we do not thereby admit that we are in the category of persons whose consent is required under Section 7 and Section 11 of the Securities Act or the rules and regulations of the Commission promulgated thereunder.

Sincerely yours,

/s/ Holland & Knight LLP