1 EXHIBIT 5.1 FOLEY, HOAG & ELIOT LLP One Post Office Square Boston, Massachusetts 02109-2170 Telephone: (617) 832-1000 Facsimile: (617) 832-7000 Telex 940693 http://www.fhe.com January 20, 1998 ASPEN TECHNOLOGY, INC. Ten Canal Park Cambridge, Massachusetts 02141 Ladies and Gentlemen: We have acted as counsel for Aspen Technology, Inc., a Massachusetts 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 up to 1,000,000 shares (the "Shares") of the Company's Common Stock, $0.10 par value, issuable pursuant to the Aspen Technology, Inc. 1998 Employee Stock Purchase 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 Restated Articles of Organization of the Company, as amended as of the date hereof; (iv) the By-Laws of the Company, as amended as of the date hereof; and (v) the minutes of a meeting of the Board of Directors of the Company held on October 9, 1997. 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. 2 ASPEN TECHNOLOGY, INC. January 20, 1998 Page Two We express no opinion other than as to the laws of the Commonwealth of Massachusetts. 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