<PAGE>

                                                                     EXHIBIT 5.1

                             Kelly, Hart & Hallman
                          (a professional corporation)
                          201 Main Street, Suite 2500
                            Forth Worth, Texas 76102

                                 June 21, 2001


XTO Energy Inc.
810 Houston Street, Suite 2000
Fort Worth, Texas 76102

     Re:  Cross Timbers Royalty Trust and XTO Energy Inc.
          Registration Statement on Form S-3
          ----------------------------------

Gentlemen:

     This firm has acted as counsel to XTO Energy Inc., a Delaware corporation
formerly named Cross Timbers Oil Company (the "Company"), in connection with the
filing by Cross Timbers Royalty Trust (the "Trust") and the Company of a
registration statement on Form S-3, No. 333-56983 (the "Registration
Statement"), with the Securities and Exchange Commission pursuant to the
Securities Act of 1933, as amended, for the registration of the sale of up to
1,460,000 units of beneficial interest in the Trust (the "Trust Units").  The
opinion set forth below is given pursuant to Item 601(b)(5) of Regulation S-K
for inclusion as Exhibit 5.1 to the Registration Statement and pertains to the
offering of such Trust Units.

     In connection with this opinion, we have made the following assumptions:
(i) all documents submitted to or reviewed by us, including all amendments and
supplements thereto, are accurate and complete and if not originals are true and
correct copies of the originals; (ii) the signatures on each of such documents
by the parties thereto are genuine; (iii) each individual who signed such
documents had the legal capacity to do so; and (iv) all persons who signed such
documents on behalf of a corporation were duly authorized to do so.  We have
assumed that there are no amendments, modifications or supplements to such
documents other than those amendments, modifications and supplements that are
known to us.

     Based on the foregoing, and subject to the limitations and qualifications
set forth herein, we are of the opinion that:

          1.  The Trust was formed and is validly existing under the laws of the
     State of Texas.

          2.  The Trust Units have been duly authorized and are validly issued
     under the laws of the State of Texas, fully paid and non-assessable.
<PAGE>

XTO Energy Inc.
June 21, 2001
Page 2


     For purposes of this opinion, "non-assessable" means that neither the trust
nor the trustee can assess a trust unitholder for additional consideration with
respect to the purchase or ownership of his trust units.

     This opinion is further limited and qualified in all respects as follows:

          A.  The opinion is specifically limited to matters of the existing
     laws of the State of Texas.  We express no opinion as to the applicability
     of the laws of any other particular jurisdiction to the transactions
     described in this opinion.

          B.  This opinion is limited to the specific opinions stated herein,
     and no other   opinion is implied or may be inferred beyond the specific
     opinions expressly stated   herein.

          C.  This opinion is based on our knowledge of the law and facts as of
     the date hereof.  We assume no duty to update or supplement this opinion to
     reflect any facts or circumstances that may hereafter come to our attention
     or to reflect any changes in any law that may hereafter occur or become
     effective.

     We call your attention to the fact that certain members of this law firm
have directly or indirectly invested in the Company's common stock and the Trust
Units.

     We hereby consent to the use of this opinion in the above-referenced
Registration Statement.  In giving such consent, we do not admit that we come
within the category of persons whose consent is required under Section 7 of the
Securities Act of 1933, as amended, or the rules and regulations of the
Securities and Exchange Commission promulgated thereunder.


                                 Respectfully submitted,

                                 /s/ Kelly, Hart & Hallman

                                 KELLY, HART & HALLMAN
                                 (a professional corporation)