Exhibit 5.1 DAVIS POLK & WARDWELL 450 Lexington Avenue New York, N.Y. 10017 July 26, 1999 The AES Corporation 1001 North 19th Street Arlington, Virginia 22209 Ladies and Gentlemen: We have acted as counsel in connection with the Registration Statement on Form S-3 (the "Registration Statement") filed by The AES Corporation (the "Company") with the Securities and Exchange Commission pursuant to the Securities Act of 1933, as amended, for the registration of the sale by the Company of $45,983,125 aggregate principal amount of common stock, par value $0.01 per share, (the "Common Stock") of the Company. The Common Stock was originally sold as part of the merger consideration in connection with the Agreement and Plan of Merger dated as of June 17, 1999 among the Company, NV Acquisition Corporation and New Energy Ventures, Inc. (the "Merger Agreement"). We have examined 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 for the purposes of rendering this opinion. On the basis of the foregoing, we are of the opinion that: The Common Stock, to be issued to New Energy Ventures, Inc.'s stockholders as part of the merger consideration pursuant to the Merger Agreement has been duly authorized and reserved and when issued and delivered in accordance with the terms of the Merger Agreement, will have been validly issued and will be fully paid and nonassessable. The AES Corporation 2 July 26, 1999 We are members of the Bar of the State of New York and the foregoing opinion is limited to the laws of the State of New York, the federal laws of the United States of America and the general corporation law of the State of Delaware. We hereby consent to the filing of this opinion as an exhibit to the Registration Statement. In addition, we consent to the reference to us under the caption "Legal Matters" in the prospectus. This opinion is rendered solely to you in connection with the above matter. This opinion may not be relied upon by you for any other purpose or relied upon by or furnished to any other person without our prior written consent. Very truly yours, /s/ Davis Polk & Wardwell