Exhibit 5.1 February 15, 2002 Blue Martini Software, Inc. 2600 Campus Drive San Mateo, CA 94403 Re: Form S-8 Ladies and Gentlemen: You have requested our opinion with respect to certain matters in connection with the filing by Blue Martini Software, Inc. (the "Company") of a Registration Statement on Form S-8 (the "Registration Statement") with the Securities and Exchange Commission covering the offering of up to (i) 10,725,357 shares of the Company's Common Stock, $.001 par value, issuable upon the exercise of stock options granted or to be granted under the Company's 2000 Equity Incentive Plan (the "2000 Equity Incentive Plan"), (ii) 1,710,354 shares of the Company's Common Stock, $.001 par value, issuable upon the purchase of shares under the Company's 2000 Employee Stock Purchase Plan (the "2000 ESPP") and (iii) 171,035 shares of the Company's Common Stock, $.001 par value, issuable upon the exercise of stock options granted or to be granted under the Company's 2000 Non-Employee Directors' Stock Option Plan (the "Directors' Plan") (together the "Shares"). In connection with this opinion, we have examined the Registration Statement, the Company's Amended and Restated Certificate of Incorporation and Bylaws, and such other documents, records, certificates, memoranda and other instruments as we deem necessary as a basis for this opinion, including a certificate executed by an officer of the Company with respect to: (i) the total number of Diluted Shares Outstanding as of January 1, 2002, as such term is defined in the 2000 Equity Incentive Plan; (ii) the total number of shares of common stock underlying stock options issued pursuant to the 2000 Equity incentive Plan during the fiscal year ended December 31, 2001; (iii) the total number of shares issued pursuant to the 2000 ESPP during the fiscal year ended December 31, 2001; and (iv) the total number of shares issued pursuant to the Directors' Plan during the fiscal year ended December 31, 2001. We have assumed the genuineness and authenticity of all documents submitted to us as originals, the conformity to originals of all documents submitted to us as copies thereof and the due execution and delivery of all documents where due execution and delivery are a prerequisite to the effectiveness thereof. Our opinion is expressed only with respect to the federal laws of the United States of America, the General Corporation Law of the State of Delaware and the laws of the State of California. We express no opinion as to whether the laws of any particular jurisdiction other than those identified above are applicable to the subject matter hereof. On the basis of the foregoing, and in reliance thereon, we are of the opinion that the Shares, when sold and issued in accordance with the 2000 Equity Incentive Plan, the 2000 ESPP, the Directors' Plan, and the Registration Statement, will be validly issued, fully paid, and nonassessable (except as to shares issued pursuant to certain deferred payment arrangements, which will be fully paid and nonassessable when such deferred payments are made in full). We consent to the filing of this opinion as an exhibit to the Registration Statement. Very truly yours, Cooley Godward LLP By: /s/ Eric C. Jensen ------------------------------ Eric C. Jensen