QuickLinks -- Click here to rapidly navigate through this document


Exhibit 5.1

Vinson & Elkins Logo       VINSON & ELKINS L.L.P.
2300 FIRST CITY TOWER
1001 FANNIN STREET
HOUSTON, TEXAS 77002-6760
TELEPHONE (713) 758-2222
FAX (713) 758-2346
www.velaw.com

October 16, 2003

Magellan Midstream Partners, L.P.
One Williams Center
Tulsa, Oklahoma 74172

Re:
Form S-3 Registration Statement

Ladies and Gentlemen:

        We have acted as counsel to Magellan Midstream Partners, L.P., a Delaware limited partnership (the "Partnership"), with respect to certain legal matters in connection with the preparation of a registration statement on Form S-3 (the "Registration Statement") to which this opinion is an exhibit. The Registration Statement relates to the offering from time to time, as set forth in the form of prospectus contained therein (the "Prospectus"), of common units, Class B common units and subordinated units, each representing limited partner interests in the Partnership (collectively, the "Units"), to be offered by the selling unitholder named in the Prospectus (the "Selling Unitholder") on the terms to be determined at the time of the offering. The Units include 7,830,924 Class B common units (the "Class B Units"), 5,679,694 subordinated units (the "Subordinated Units") and 14,590,312 common units (the "Common Units"), which includes 13,510,618 Common Units issuable upon conversion of the Class B Units and the Subordinated Units. We have also participated in the preparation of the Prospectus.

        In rendering the opinions set forth below, we have examined and relied upon (i) the Registration Statement, including the Prospectus; (ii) the Second Amended and Restated Agreement of Limited Partnership of the Partnership, as amended by Amendment No. 1 to the Second Amended and Restated Agreement of Limited Partnership and Amendment No. 2 to the Second Amended and Restated Agreement of Limited Partnership (as amended, the "Partnership Agreement") and (iii) such certificates, statutes and other instruments and documents as we consider appropriate for purposes of the opinions hereafter expressed.

        In connection with this opinion, we have assumed that (i) the Registration Statement and any amendments thereto (including post-effective amendments) will have become effective; (ii) a Prospectus Supplement will have been prepared and filed with the Securities and Exchange Commission describing the Units offered thereby; (iii) all Units will be issued and sold in compliance with applicable federal and state securities laws and in the manner stated in the Registration Statement and the appropriate Prospectus Supplement; (iv) a definitive purchase, underwriting or similar agreement with respect to any Units offered will have been duly authorized and validly executed and delivered by the Partnership, the Selling Unitholder and the other parties thereto; and (v) any Units issuable upon conversion of any Unit being offered will be duly authorized, created and, if appropriate, reserved for issuance upon such conversion.

        Based upon and subject to the foregoing, we are of the opinion that:


        The opinions expressed herein are qualified in the following respects:

        We hereby consent to the references to this firm under the caption "Legal Matters" in the Prospectus and to the filing of this opinion as an Exhibit to the Registration Statement. By giving such consent, we do not admit that we are within the category of persons whose consent is required under Section 7 of the Securities Act or the rules and regulations of the Securities and Exchange Commission issued thereunder.




QuickLinks