1 Exhibit 5.1 FOLEY, HOAG & ELIOT LLP ONE POST OFFICE SQUARE BOSTON, MASSACHUSETTS 02109-2170 TELEPHONE 617-832-1000 1747 PENNSYLVANIA AVE., N.W. FACSIMILE 617-832-7000 WASHINGTON, D.C. 20006 http://www.fhe.com TEL: 202-223-1200 FAX: 202-785-6687 June 8, 1999 ASPEN TECHNOLOGY, INC. Ten Canal Park Cambridge, Massachusetts 02141 Ladies and Gentlemen: We have acted as counsel for Aspen Technology, Inc., a Delaware corporation (the "Company"), in connection with the preparation and filing with the Securities and Exchange Commission under the Securities Act of 1933, as amended, of a Registration Statement on Form S-8 (the "Registration Statement") relating to the offering by the Company of 2,255,608 shares (the "Shares") of its common stock, $.10 par value, issuable pursuant to the Aspen Technology, Inc. 1995 Stock Option Plan (the "Plan"). In arriving at the opinions expressed below, we have examined and relied on the following documents: (i) the Registration Statement; (ii) the Plan; (iii) the Certificate of Incorporation and By-Laws of the Company; and (iv) a written consent adopted by the Board of Directors as of June 3, 1999. In addition, we have examined and relied on the originals or copies certified or otherwise identified to our satisfaction of all such other records, documents and instruments of the Company and such other persons, and we have made such investigations of law, as we have deemed appropriate as a basis for the opinions expressed below. We have assumed the genuineness of all signatures and the authenticity of all documents submitted to us as originals and the conformity to the original documents of all documents submitted to us as certified or photostatic copies. We express no opinion other than as to the General Corporation Law of the State of Delaware. 2 ASPEN TECHNOLOGY, INC. June 8, 1999 Page Two Based upon the foregoing, we are of the opinion that: 1. The Company has the corporate power necessary for the issuance of the Shares under the Plan, as contemplated by the Registration Statement. 2. The Shares have been duly authorized and, when issued against payment of the agreed consideration therefor in accordance with the respective exercise prices therefor as described in the Plan, will be validly issued, fully paid and non-assessable. We consent to the filing of this opinion as Exhibit 5.1 to the Registration Statement. Very truly yours, FOLEY, HOAG & ELIOT LLP By /s/ Mark L. Johnson --------------------------------- A Partner