EX-5.1 2 a2160338zex-5_1.htm EXHIBIT 5.1
QuickLinks -- Click here to rapidly navigate through this document


EXHIBIT 5.1

[VALERO ENERGY CORPORATION LETTERHEAD]

July 11, 2005

Valero Energy Corporation
One Valero Way
San Antonio, Texas 78249

Ladies and Gentlemen:

        I am Vice President and Corporate Secretary of Valero Energy Corporation, a Delaware corporation (the "Company"), and have acted as counsel for the Company in connection with the preparation and filing with the Securities and Exchange Commission (the "Commission") under the Securities Act of 1933, as amended (the "Securities Act") of a Registration Statement on Form S-4 (the "Registration Statement") relating to registration under the Securities Act of the issuance of shares of Common Stock, par value $0.01 per share, of the Company (the "Common Stock") in connection with the merger of Premcor Inc. ("Premcor") with and into the Company, as contemplated by the Agreement and Plan of Merger, dated as of April 24, 2005, by and between Premcor and the Company (the "Merger Agreement").

        I have examined the Merger Agreement and originals or copies, certified or otherwise identified to my satisfaction, of such other documents, corporate records, certificates of public officials and other instruments as I have deemed necessary or advisable for the purpose of and in connection with rendering this opinion. I have relied as to certain matters on information obtained from public officials, officers of the Company and other sources believed by me to be responsible.

        Based on the foregoing, I am of the opinion that the shares of Common Stock have been duly authorized and (i) when the Registration Statement has become effective under the Securities Act and (ii) when the shares of Common Stock have been duly executed, countersigned and delivered by the Company upon the consummation of the transaction as contemplated in the Merger Agreement and the Registration Statement, such shares of Common Stock will be validly issued, fully paid and nonassessable.

        I am a member of the Bar of the State of Texas and my opinion is limited to the federal statutory laws of the United States, the laws of the State of Texas and the Delaware General Corporation Law.

        I hereby consent to the filing of this opinion as an exhibit to the Registration Statement and to the reference to me under the heading "Legal Matters" in the proxy statement / prospectus that forms a part of the Registration Statement. In giving such opinion, I do not thereby admit that I am in the category of persons whose consent is required under Section 7 of the Securities Act.

    Very truly yours,

 

 

/s/  
Jay D. Browning      
Jay D. Browning
Vice President and Corporate Secretary



QuickLinks