<PAGE>

                                                                     Exhibit 5.1

            [BUCHANAN INGERSOLL PROFESSIONAL CORPORATION LETTERHEAD]

                                 August 6, 2002

Board of Directors
The AES Corporation
1001 North 19th Street
Arlington, Virginia 22209

Ladies and Gentlemen:

         We have acted as counsel to The AES Corporation, a Delaware corporation
(the "Corporation"), in connection with the proposed issuance by the Corporation
of up to 7,500,000 shares of the Corporation's common stock (the "Common
Stock"), pursuant to the terms of The AES Corporation Profit Sharing and Stock
Ownership Plan (the "Plan").

         In connection with such proposed issuance, we have examined the Plan,
the Certificate of Incorporation of the Corporation, as amended and restated,
the By-laws of the Corporation, as amended, the relevant corporate proceedings
of the Corporation, the Registration Statement on Form S-8 covering the issuance
of the Common Stock, and such other documents, records, certificates of public
officials, statutes and decisions as we consider necessary to express the
opinions contained herein. In the examination of such documents, we have assumed
the genuineness of all signatures and the authenticity of all documents
submitted to us as originals and the conformity to those original documents of
all documents submitted to us as certified or photostatic copies.

         Based on the foregoing, we are of the opinion that when the
Registration Statement shall have been declared effective by order of the
Securities and Exchange Commission and when the Common Stock has been duly
issued and delivered pursuant to the terms of the Plan, such shares of Common
Stock will be validly issued, fully paid and non-assessable.

         We hereby consent to the filing of this opinion as an exhibit to the
Registration Statement.

                                        Very truly yours,

                                        BUCHANAN INGERSOLL
                                        PROFESSIONAL CORPORATION

                                        By: /s/ Ronald Basso
                                            -------------------------------
                                            Ronald Basso


