<PAGE>

                                                                    EXHIBIT 10.8

                          BLUE MARTINI SOFTWARE, INC.

                  SERIES B PREFERRED STOCK PURCHASE AGREEMENT
<PAGE>

                              Table Of Contents

<TABLE>
<CAPTION>
                                                                            Page
<S>                                                                         <C>
1.   Agreement To Sell And Purchase........................................    1

     1.1   Authorization of Shares.........................................    1
     1.2   Sale and Purchase...............................................    1

2.   Closing, Delivery And Payment.........................................    1

     2.1   Closing.........................................................    1
     2.2   Delivery........................................................    2
     2.3   Subsequent Sales of Shares......................................    2

3.   Representations And Warranties Of The Company.........................    2

     3.1   Organization, Good Standing and Qualification...................    2
     3.2   Subsidiaries....................................................    2
     3.3   Capitalization; Voting Rights...................................    2
     3.4   Authorization; Binding Obligations..............................    3
     3.5   Liabilities.....................................................    3
     3.6   Obligations to Related Parties..................................    4
     3.7   Title to Properties and Assets; Liens, Etc......................    4
     3.8   Patents and Trademarks..........................................    4
     3.9   Compliance with Other Instruments...............................    5
     3.10  Litigation......................................................    5
     3.11  Tax Returns and Payments........................................    5
     3.12  Employees.......................................................    6
     3.13  Proprietary Information and Inventions Agreements...............    6
     3.14  Registration Rights.............................................    6
     3.15  Offering Valid..................................................    6

4.   Representations And Warranties Of The Purchasers......................    7

     4.1   Requisite Power and Authority...................................    7
     4.2   Investment Representations......................................    7
     4.3   Transfer Restrictions...........................................    8
</TABLE>

                                       i
<PAGE>

                               Table Of Contents
                                  (Continued)

<TABLE>
<CAPTION>
                                                                            Page
<S>                                                                         <C>
5.   Conditions To Closing................................................     8

     5.1   Conditions to Purchasers' Obligations at the Closing...........     8
     5.2   Conditions to Obligations of the Company.......................    10

6.   Miscellaneous........................................................    10

     6.1   Governing Law..................................................    10
     6.2   Survival.......................................................    10
     6.3   Successors and Assigns.........................................    11
     6.4   Entire Agreement...............................................    11
     6.5   Severability...................................................    11
     6.6   Amendment and Waiver...........................................    11
     6.7   Delays or Omissions............................................    11
     6.8   Waiver of Conflicts............................................    12
     6.9   Notices........................................................    12
     6.10  Expenses.......................................................    12
     6.11  Attorneys' Fees................................................    12
     6.12  Titles and Subtitles...........................................    12
     6.13  Counterparts...................................................    12
     6.14  Broker's Fees..................................................    12
     6.15  Exculpation Among Purchasers...................................    13
     6.16  Confidentiality................................................    13
     6.17  Pronouns.......................................................    13
     6.18  California Corporate Securities Law............................    13
</TABLE>

                                      ii
<PAGE>

                          BLUE MARTINI SOFTWARE, INC.

                  SERIES B PREFERRED STOCK PURCHASE AGREEMENT

     This Series B Preferred Stock Purchase Agreement (the "Agreement") is
entered into as of January 13, 1999, by and among Blue Martini Software, Inc., a
Delaware corporation (the "Company") and each of those persons and entities,
severally and not jointly, whose names are set forth on the Schedule of
Purchasers attached hereto as Exhibit A (which persons and entities are
hereinafter collectively referred to as "Purchasers" and each individually as a
"Purchaser").

                                    Recitals

     Whereas, the Company has authorized the sale and issuance of an aggregate
of two million six hundred thirty-one thousand five hundred seventy-nine
(2,631,579) shares of its Series B Preferred Stock (the "Shares");

     Whereas, Purchasers desire to purchase the Shares on the terms and
conditions set forth herein; and

     Whereas, the Company desires to issue and sell the Shares to Purchasers on
the terms and conditions set forth herein;

     Now, Therefore, in consideration of the foregoing recitals and the mutual
promises hereinafter set forth, the parties hereto agree as follows:

     1.   Agreement To Sell And Purchase.

          1.1  Authorization of Shares. On or prior to the Closing (as defined
in Section 2 below), the Company shall have authorized (a) the sale and issuance
to Purchasers of the Shares and (b) the issuance of such shares of Common Stock
to be issued upon conversion of the Shares (the "Conversion Shares"). The Shares
and the Conversion Shares shall have the rights, preferences, privileges and
restrictions set forth in the Certificate of Incorporation of the Company, in
the form attached hereto as Exhibit B (the "Charter").

          1.2  Sale and Purchase. Subject to the terms and conditions hereof, at
the Closing (as hereinafter defined) the Company hereby agrees to issue and sell
to each Purchaser, severally and not jointly, and each Purchaser agrees to
purchase from the Company, severally and not jointly, the number of Shares set
forth opposite such Purchaser's name on Exhibit A, at a purchase price of one
dollar and ninety cents ($1.90) per share.

     2.   Closing, Delivery And Payment.

          2.1  Closing. The closing of the sale and purchase of the Shares under
this Agreement (the "Closing") shall take place at 5:00 p.m. on the date hereof,
at the offices of Cooley Godward llp, 3000 Sand Hill Road, Building 3, Suite
230, Menlo Park, California 94025

                                       1.
<PAGE>

or at such other time or place as the Company and Purchasers may mutually agree
(such date is hereinafter referred to as the "Closing Date").

          2.2  Delivery. At the Closing, subject to the terms and conditions
hereof, the Company will deliver to each Purchaser a certificate representing
the number of Shares to be purchased at the Closing by such Purchaser, against
payment of the purchase price therefor by check, wire transfer made payable to
the order of the Company, cancellation of indebtedness or any combination of the
foregoing.

          2.3  Subsequent Sales of Shares. At any time on or before the 120th
day following the Closing, the Company may sell up to the balance of the
authorized shares of Series B Preferred Stock not sold at the Closing to such
persons as may be approved by the Board of Directors of the Company. All such
sales shall be made on the terms and conditions set forth in this Agreement,
including, without limitation, the representations and warranties by such
Purchasers as set forth in Section 4. Any Shares of Series B Preferred Stock
sold pursuant to this Section 2.3 shall be deemed to be "Shares" for all
purposes under this Agreement and any purchasers thereof shall be deemed to be
"Purchasers" for all purposes under this Agreement.

     3.   Representations And Warranties Of The Company.

          Except as set forth on a Schedule of Exceptions delivered by the
Company to the Purchasers at the Closing, the Company hereby represents and
warrants to each Purchaser as of the date of this Agreement as follows:

          3.1  Organization, Good Standing and Qualification. The Company is a
corporation duly organized, validly existing and in good standing under the laws
of the State of California. The Company has all requisite corporate power and
authority to own and operate its properties and assets, to execute and deliver
this Agreement, the Investor Rights Agreement in the form attached hereto as
Exhibit C (the "Investor Rights Agreement") and the Co-Sale Agreement in the
form attached hereto as Exhibit D (the "Co-Sale Agreement") (collectively, the
"Related Agreements"), to issue and sell the Shares and the Conversion Shares,
and to carry out the provisions of this Agreement, the Related Agreements and
the Charter and to carry on its business as presently conducted and as presently
proposed to be conducted.

          3.2  Subsidiaries. The Company does not own or control any equity
security or other interest of any other corporation, limited partnership or
other business entity. The Company is not a participant in any joint venture,
partnership or similar arrangement.

          3.3  Capitalization; Voting Rights. The authorized capital stock of
the Company, immediately prior to the Closing, will consist of twenty million
(20,000,000) shares of Common Stock, (par value $0.001) per share, seven million
five hundred sixty-three thousand one hundred twenty-five (7,563,125) shares of
which are issued and outstanding and four million one hundred thirty thousand
(4,130,000) shares of which are reserved for issuance to employees pursuant to
the Company's Amended and Restated 1998 Equity Incentive Plan (the "Plan") and
five million (5,000,000) shares of Preferred Stock (par value $0.001) per share,
two million (2,000,000) shares of which are designated Series A Preferred Stock,
one million one hundred

                                       2.
<PAGE>

sixteen thousand seventy-one (1,116,071) of which are issued and outstanding and
three million (3,000,000) shares of which are designated Series B Preferred
Stock, none of which are issued and outstanding. All issued and outstanding
shares of the Company's Common Stock and Preferred Stock (a) have been duly
authorized and validly issued and (b) are fully paid and nonassessable. The
rights, preferences, privileges and restrictions of the Shares are as stated in
the Charter. Each series of Preferred Stock is convertible into Common Stock on
a one-for-one basis. The Conversion Shares have been duly and validly reserved
for issuance. Other than the four million one hundred thirty thousand
(4,130,000) shares reserved for issuance under the Plan, and except as may be
granted pursuant to the Related Agreements, there are no outstanding options,
warrants, rights (including conversion or preemptive rights and rights of first
refusal), proxy or shareholder agreements, or agreements of any kind for the
purchase or acquisition from the Company of any of its securities. Of such
reserved shares of Common Stock under the Plan, (i) two million sixty-three
thousand one hundred twenty-five (2,063,125) shares have been issued pursuant to
restricted stock purchase agreements and (ii) two million sixty-six thousand
eight hundred seventy-five (2,066,875) shares of Common Stock remain available
for issuance to officers, directors, employees and consultants pursuant to such
Plan. When issued in compliance with the provisions of this Agreement and the
Charter, the Shares and the Conversion Shares will be validly issued, fully paid
and nonassessable, and will be free of any liens or encumbrances other than
liens and encumbrances created by or imposed upon the Purchasers; provided,
however, that the Shares and the Conversion Shares may be subject to
restrictions on transfer under state and/or federal securities laws as set forth
herein or as otherwise required by such laws at the time a transfer is proposed.

          3.4  Authorization; Binding Obligations. All corporate action on the
part of the Company, its officers, directors and shareholders necessary for the
authorization of this Agreement and the Related Agreements, the performance of
all obligations of the Company hereunder and thereunder at the Closing and the
authorization, sale, issuance and delivery of the Shares pursuant hereto and the
Conversion Shares pursuant to the Charter has been taken or will be taken prior
to the Closing. The Agreement and the Related Agreements, when executed and
delivered, will be valid and binding obligations of the Company enforceable in
accordance with their terms, except (a) as limited by applicable bankruptcy,
insolvency, reorganization, moratorium or other laws of general application
affecting enforcement of creditors' rights, (b) general principles of equity
that restrict the availability of equitable remedies, and (c) to the extent that
the enforceability of the indemnification provisions in Section 2.9 of the
Investor Rights Agreement may be limited by applicable laws. The sale of the
Shares and the subsequent conversion of the Shares into Conversion Shares are
not and will not be subject to any preemptive rights or rights of first refusal
that have not been properly waived or complied with.

          3.5  Liabilities. The Company has no material liabilities and, to the
best of its knowledge, knows of no material contingent liabilities, except
current liabilities incurred in the ordinary course of business subsequent which
have not been, either in any individual case or in the aggregate, materially
adverse.

               (a)  There are no agreements, understandings, instruments,
contracts, proposed transactions, judgments, orders, writs or decrees to which
the Company is a party or to its knowledge by which it is bound which may
involve (i) obligations (contingent or otherwise)

                                       3.
<PAGE>

of, or payments to, the Company in excess of ten thousand dollars ($10,000)
(other than obligations of, or payments to, the Company arising from purchase or
sale agreements entered into in the ordinary course of business), or (ii) the
transfer or license of any patent, copyright, trade secret or other proprietary
right to or from the Company (other than licenses arising from the purchase of
"off the shelf" or other standard products), or (iii) indemnification by the
Company with respect to infringements of proprietary rights (other than
indemnification obligations arising from purchase or sale or license agreements
entered into in the ordinary course of business).

               (b)  For the purposes of subsection (a) above, all indebtedness,
liabilities, agreements, understandings, instruments, contracts and proposed
transactions involving the same person or entity (including persons or entities
the Company has reason to believe are affiliated therewith) shall be aggregated
for the purpose of meeting the individual minimum dollar amounts of such
subsections.

          3.6  Obligations to Related Parties. There are no obligations of the
Company to officers, directors, shareholders, or employees of the Company other
than (a) for payment of salary for services rendered, (b) reimbursement for
reasonable expenses incurred on behalf of the Company and (c) for other standard
employee benefits made generally available to all employees (including stock
option or purchase agreements outstanding under any stock option plan approved
by the Board of Directors of the Company).

          3.7  Title to Properties and Assets; Liens, Etc. The Company has good
and marketable title to its properties and assets, including the properties and
assets reflected in the most recent balance sheet, and good title to its
leasehold estates, in each case subject to no mortgage, pledge, lien, lease,
encumbrance or charge, other than (a) those resulting from taxes which have not
yet become delinquent, (b) minor liens and encumbrances which do not materially
detract from the value of the property subject thereto or materially impair the
operations of the Company, and (c) those that have otherwise arisen in the
ordinary course of business.

          3.8  Patents and Trademarks. To the best of its knowledge, the Company
owns or possesses sufficient legal rights to all patents, trademarks, service
marks, trade names, copyrights, trade secrets, licenses, information and other
proprietary rights and processes necessary for its business as now conducted and
as presently proposed to be conducted, without any known infringement of the
rights of others. There are no outstanding options, licenses or agreements of
any kind relating to the foregoing, nor is the Company bound by or a party to
any options, licenses or agreements of any kind with respect to the patents,
trademarks, service marks, trade names, copyrights, trade secrets, licenses,
information and other proprietary rights and processes of any other person or
entity other than such licenses or agreements arising from the purchase of "off
the shelf" or standard products. The Company has not received any communications
alleging that the Company has violated or, by conducting its business as
presently proposed in the Business Plan provided to the Purchasers (the
"Business Plan"), would violate any of the patents, trademarks, service marks,
trade names, copyrights or trade secrets or other proprietary rights of any
other person or entity. The Company is not aware that any of its employees is
obligated under any contract (including licenses, covenants or commitments of
any

                                       4.
<PAGE>

nature) or other agreement, or subject to any judgment, decree or order of any
court or administrative agency, that would interfere with their duties to the
Company or that would conflict with the Company's business as presently proposed
to be conducted in the Business Plan. Neither the execution nor delivery of this
Agreement or the Related Agreements, nor the carrying on of the Company's
business by the employees of the Company, nor the conduct of the Company's
business as presently proposed in the Business Plan, will, to the Company's
knowledge, conflict with or result in a breach of the terms, conditions or
provisions of, or constitute a default under, any contract, covenant or
instrument under which any employee is now obligated. The Company does not
believe it is or will be necessary to utilize any inventions, trade secrets or
proprietary information of any of its employees made prior to their employment
by the Company, except for inventions, trade secrets or proprietary information
that have been assigned to the Company.

          3.9  Compliance with Other Instruments. The Company is not in
violation or default of any term of its Charter or Bylaws, or of any provision
of any mortgage, indenture, contract, agreement, instrument or contract to which
it is party or by which it is bound or of any judgment, decree, order, writ. The
execution, delivery, and performance of and compliance with this Agreement, and
the Related Agreements, and the issuance and sale of the Shares pursuant hereto
and of the Conversion Shares pursuant to the Charter, will not, with or without
the passage of time or giving of notice, result in any such material violation,
or be in conflict with or constitute a default under any such term, or result in
the creation of any mortgage, pledge, lien, encumbrance or charge upon any of
the properties or assets of the Company or the suspension, revocation,
impairment, forfeiture or nonrenewal of any permit, license, authorization or
approval applicable to the Company, its business or operations or any of its
assets or properties.

          3.10 Litigation. There is no action, suit, proceeding or investigation
pending or to the Company's knowledge currently threatened in writing against
the Company that questions the validity of this Agreement, or the Related
Agreements or the right of the Company to enter into any of such agreements, or
to consummate the transactions contemplated hereby or thereby, or which might
result, either individually or in the aggregate, in any material adverse change
in the assets, condition, affairs or prospects of the Company, financially or
otherwise, or any change in the current equity ownership of the Company, nor is
the Company aware that there is any basis for any of the foregoing. The
foregoing includes, without limitation, actions pending or threatened in writing
(or any basis therefor known to the Company) involving the prior employment of
any of the Company's employees, their use in connection with the Company's
business of any information or techniques allegedly proprietary to any of their
former employers, or their obligations under any agreements with prior
employers. The Company is not a party or subject to the provisions of any order,
writ, injunction, judgment or decree of any court or government agency or
instrumentality. There is no action, suit, proceeding or investigation by the
Company currently pending or which the Company intends to initiate.

          3.11 Tax Returns and Payments. The Company has filed all tax returns
(federal, state and local) required to be filed by it. All taxes shown to be due
and payable on such returns, any assessments imposed, and to the Company's
knowledge all other taxes due and payable by the Company on or before the
Closing, have been paid or will be paid prior to the time they become
delinquent. The Company has not been advised (a) that any of its returns,

                                       5.
<PAGE>

federal, state or other, have been or are being audited as of the date hereof,
or (b) of any deficiency in assessment or proposed judgment to its federal,
state or other taxes. The Company has no knowledge of any liability of any tax
to be imposed upon its properties or assets as of the date of this Agreement
that is not adequately provided for.

          3.12 Employees. The Company has no collective bargaining agreements
with any of its employees. There is no labor union organizing activity pending
or, to the Company's knowledge, threatened with respect to the Company. To the
Company's knowledge, no employee of the Company, nor any consultant with whom
the Company has contracted, is in violation of any term of any employment
contract, proprietary information agreement or any other agreement relating to
the right of any such individual to be employed by, or to contract with, the
Company because of the nature of the business to be conducted by the Company;
and to the Company's knowledge the continued employment by the Company of its
present employees, and the performance of the Company's contracts with its
independent contractors, will not result in any such violation. The Company has
not received any notice alleging that any such violation has occurred. No
employee of the Company has been granted the right to continued employment by
the Company or to any material compensation following termination of employment
with the Company. The Company is not aware that any officer or key employee, or
that any group of key employees, intends to terminate his, her or their
employment with the Company, nor does the Company have a present intention to
terminate the employment of any officer, key employee or group of key employees.

          3.13 Proprietary Information and Inventions Agreements. Each employee,
officer and consultant of the Company has executed a Proprietary Information and
Inventions Agreement. No current employee, officer or consultant of the Company
has excluded works or inventions made prior to his or her employment with the
Company from his or her assignment of inventions pursuant to such employee,
officer or consultant's Proprietary Information and Inventions Agreement.

          3.14 Registration Rights. Except as required pursuant to the Investor
Rights Agreement, the Company is presently not under any obligation, and has not
granted any rights, to register (as defined in Section 1.1 of the Investor
Rights Agreement) any of the Company's presently outstanding securities or any
of its securities that may hereafter be issued.

          3.15 Offering Valid. Assuming the accuracy of the representations and
warranties of the Purchasers contained in Section 4.2 hereof, the offer, sale
and issuance of the Shares and the Conversion Shares will be exempt from the
registration requirements of the Securities Act of 1933, as amended (the
"Securities Act"), and will have been registered or qualified (or are exempt
from registration and qualification) under the registration, permit or
qualification requirements of all applicable state securities laws. Neither the
Company nor any agent on its behalf has solicited or will solicit any offers to
sell or has offered to sell or will offer to sell all or any part of the Shares
to any person or persons so as to bring the sale of such Shares by the Company
within the registration provisions of the Securities Act or any state securities
laws.

                                       6.
<PAGE>

     4.   Representations And Warranties Of The Purchasers.

          Each Purchaser hereby represents and warrants to the Company as
follows (such representations and warranties do not lessen or obviate the
representations and warranties of the Company set forth in this Agreement):

          4.1  Requisite Power and Authority. Purchaser has all necessary power
and authority under all applicable provisions of law to execute and deliver this
Agreement and the Related Agreements and to carry out their provisions. All
action on Purchaser's part required for the lawful execution and delivery of
this Agreement and the Related Agreements have been or will be effectively taken
prior to the Closing. Upon their execution and delivery, this Agreement and the
Related Agreements will be valid and binding obligations of Purchaser,
enforceable in accordance with their terms, except (a) as limited by applicable
bankruptcy, insolvency, reorganization, moratorium or other laws of general
application affecting enforcement of creditors' rights, (b) general principles
of equity that restrict the availability of equitable remedies, and (c) to the
extent that the enforceability of the indemnification provisions of Section 2.9
of the Investor Rights Agreement may be limited by applicable laws.

          4.2  Investment Representations. Purchaser understands that neither
the Shares nor the Conversion Shares have been registered under the Securities
Act. Purchaser also understands that the Shares are being offered and sold
pursuant to an exemption from registration contained in the Securities Act based
in part upon Purchaser's representations contained in the Agreement. Purchaser
hereby represents and warrants as follows:

               (a)  Purchaser Bears Economic Risk. Purchaser has substantial
experience in evaluating and investing in private placement transactions of
securities in companies similar to the Company so that it is capable of
evaluating the merits and risks of its investment in the Company and has the
capacity to protect its own interests. Purchaser must bear the economic risk of
this investment indefinitely unless the Shares (or the Conversion Shares) are
registered pursuant to the Securities Act, or an exemption from registration is
available. Purchaser understands that the Company has no present intention of
registering the Shares, the Conversion Shares or any shares of its Common Stock.
Purchaser also understands that there is no assurance that any exemption from
registration under the Securities Act will be available and that, even if
available, such exemption may not allow Purchaser to transfer all or any portion
of the Shares or the Conversion Shares under the circumstances, in the amounts
or at the times Purchaser might propose.

               (b)  Acquisition for Own Account. Purchaser is acquiring the
Shares and the Conversion Shares for Purchaser's own account for investment
only, and not with a view towards their distribution.

               (c)  Purchaser Can Protect Its Interest. Purchaser represents
that by reason of its, or of its management's, business or financial experience,
Purchaser has the capacity to protect its own interests in connection with the
transactions contemplated in this Agreement, and the Related Agreements.
Further, Purchaser is aware of no publication of any advertisement in connection
with the transactions contemplated in the Agreement.

                                       7.
<PAGE>

               (d)  Accredited Investor. Purchaser represents that it is an
accredited investor within the meaning of Regulation D under the Securities Act.


               (e)  Company Information. Purchaser has received and read the
Company's financial statements and Business Plan and has had an opportunity to
discuss the Company's business, management and financial affairs with directors,
officers and management of the Company and has had the opportunity to review the
Company's operations and facilities. Purchaser has also had the opportunity to
ask questions of and receive answers from, the Company and its management
regarding the terms and conditions of this investment.

               (f)  Rule 144. Purchaser acknowledges and agrees that the Shares,
and, if issued, the Conversion Shares must be held indefinitely unless they are
subsequently registered under the Securities Act or an exemption from such
registration is available. Purchaser has been advised or is aware of the
provisions of Rule 144 promulgated under the Securities Act as in effect from
time to time, which permits limited resale of shares purchased in a private
placement subject to the satisfaction of certain conditions, including, among
other things: the availability of certain current public information about the
Company, the resale occurring following the required holding period under Rule
144 and the number of shares being sold during any three-month period not
exceeding specified limitations.

               (g)  Residence. If the Purchaser is an individual, then the
Purchaser resides in the state or province identified in the address of the
Purchaser set forth on Exhibit A; if the Purchaser is a partnership,
corporation, limited liability company or other entity, then the office or
offices of the Purchaser in which its investment decision was made is located at
the address or addresses of the Purchaser set forth on Exhibit A.

          4.3  Transfer Restrictions. Each Purchaser acknowledges and agrees
that the Shares and, if issued, the Conversion Shares are subject to
restrictions on transfer as set forth in the Investor Rights Agreement.

     5.   Conditions To Closing.

          5.1  Conditions to Purchasers' Obligations at the Closing. Purchasers'
obligations to purchase the Shares at the Closing are subject to the
satisfaction, at or prior to the Closing Date, of the following conditions:

               (a)  Representations and Warranties True; Performance of
Obligations. The representations and warranties made by the Company in Section 3
hereof shall be true and correct in all material respects as of the Closing Date
with the same force and effect as if they had been made as of the Closing Date,
and the Company shall have performed all obligations and conditions herein
required to be performed or observed by it on or prior to the Closing.

               (b)  Legal Investment. On the Closing Date, the sale and issuance
of the Shares and the proposed issuance of the Conversion Shares shall be
legally permitted by all laws and regulations to which Purchasers and the
Company are subject.

                                       8.
<PAGE>

               (c)  Consents, Permits, and Waivers. The Company shall have
obtained any and all consents, permits and waivers necessary or appropriate for
consummation of the transactions contemplated by the Agreement and the Related
Agreements (except for such as may be properly obtained subsequent to the
Closing).

               (d)  Filing of Charter. The Charter shall have been filed with
the Secretary of State of the State of Delaware and shall continue to be in full
force and effect as of the Closing Date.

               (e)  Corporate Documents. The Company shall have delivered to
Purchasers or their counsel, copies of all corporate documents of the Company as
Purchasers shall reasonably request.

               (f)  Reservation of Conversion Shares. The Conversion Shares
issuable upon conversion of the Shares shall have been duly authorized and
reserved for issuance upon such conversion.

               (g)  Compliance Certificate. The Company shall have delivered to
Purchasers a Compliance Certificate, executed by the President of the Company,
dated the Closing Date, to the effect that the conditions specified in
subsections (a), (c), (d) and (f) of this Section 5.1 have been satisfied.

               (h)  Investor Rights Agreement. An Investor Rights Agreement
substantially in the form attached hereto as Exhibit C shall have been executed
and delivered by the parties thereto.

               (i)  Co-Sale Agreement. The Co-Sale Agreement substantially in
the form attached hereto as Exhibit D shall have been executed and delivered by
the parties thereto. The stock certificates representing the shares subject to
the Co-Sale Agreement shall have been delivered to the Secretary of the Company
and shall have had appropriate legends placed upon them to reflect the
restrictions on transfer set forth on the Co-Sale Agreement.

               (j)  Board of Directors. Upon the Closing, the authorized size of
the Board of Directors of the Company shall be six (6) members and the Board
shall consist of James Gaither, Thomas Siebel, A. Michael Spence, Andrew
Verhalen, William Zuendt and Monte Zweben.

               (k)  Proceedings and Documents. All corporate and other
proceedings in connection with the transactions contemplated at the Closing
hereby and all documents and instruments incident to such transactions shall be
reasonably satisfactory in substance and form to the Purchasers and their
special counsel, and the Purchasers and their special counsel shall have
received all such counterpart originals or certified or other copies of such
documents as they may reasonably request.

               (l)  Agreement and Plan of Merger. The Agreement and Plan of
Merger substantially in the form attached hereto as Exhibit E shall have been
executed and

                                       9.
<PAGE>

delivered by the parties thereto and the Certificate of Merger shall have been
filed with the Secretary of State of the State of Delaware.

          5.2  Conditions to Obligations of the Company. The Company's
obligation to issue and sell the Shares at each Closing is subject to the
satisfaction, on or prior to such Closing, of the following conditions:

               (a)  Representations and Warranties True. The representations and
warranties in Section 4 made by those Purchasers acquiring Shares hereof shall
be true and correct in all material respects at the date of the Closing, with
the same force and effect as if they had been made on and as of said date.

               (b)  Performance of Obligations. Such Purchasers shall have
performed and complied with all agreements and conditions herein required to be
performed or complied with by such Purchasers on or before the Closing.

               (c)  Filing of Charter. The Charter shall have been filed with
the Secretary of State of the State of Delaware.

               (d)  Investor Rights Agreement. An Investor Rights Agreement
substantially in the form attached hereto as Exhibit C shall have been executed
and delivered by the Purchasers.

               (e)  Co-Sale Agreement. The Co-Sale Agreement substantially in
the form attached hereto as Exhibit D shall have been executed and delivered by
the parties thereto.

               (f)  Consents, Permits, and Waivers. The Company shall have
obtained any and all consents, permits and waivers necessary or appropriate for
consummation of the transactions contemplated by the Agreement and the Related
Agreements (except for such as may be properly obtained subsequent to the
Closing).

     6.   Miscellaneous.

          6.1  Governing Law. This Agreement shall be governed in all respects
by the laws of the State of California as such laws are applied to agreements
between California residents entered into and performed entirely in California.

          6.2  Survival. The representations, warranties, covenants and
agreements made herein shall survive any investigation made by any Purchaser and
the closing of the transactions contemplated hereby for a period of one (1) year
following the Closing. All statements as to factual matters contained in any
certificate or other instrument delivered by or on behalf of the Company
pursuant hereto in connection with the transactions contemplated hereby shall be
deemed to be representations and warranties by the Company hereunder solely as
of the date of such certificate or instrument.

          6.3  Successors and Assigns. Except as otherwise expressly provided
herein, the provisions hereof shall inure to the benefit of, and be binding
upon, the successors, assigns,

                                      10.
<PAGE>

heirs, executors and administrators of the parties hereto and shall inure to the
benefit of and be enforceable by each person who shall be a holder of the Shares
from time to time.

          6.4  Entire Agreement.  This Agreement, the Exhibits and Schedules
hereto, the Related Agreements and the other documents delivered pursuant hereto
constitute the full and entire understanding and agreement between the parties
with regard to the subjects hereof and no party shall be liable or bound to any
other in any manner by any representations, warranties, covenants and agreements
except as specifically set forth herein and therein.

          6.5  Severability.  In case any provision of the Agreement shall be
invalid, illegal or unenforceable, the validity, legality and enforceability of
the remaining provisions shall not in any way be affected or impaired thereby.

          6.6  Amendment and Waiver.

               (a)  This Agreement may be amended or modified only upon the
written consent of the Company and holders of at least a majority of the Shares
(treated as if converted and including any Conversion Shares into which the
Shares have been converted that have not been sold to the public).

               (b)  The obligations of the Company and the rights of the holders
of the Shares and the Conversion Shares under the Agreement may be waived only
with the written consent of the holders of at least a majority of the Shares
(treated as if converted and including any Conversion Shares into which the
Shares have been converted that have not been sold to the public).

          6.7  Delays or Omissions.  It is agreed that no delay or omission to
exercise any right, power or remedy accruing to any party, upon any breach,
default or noncompliance by another party under this Agreement, the Related
Agreements or the Charter, shall impair any such right, power or remedy, nor
shall it be construed to be a waiver of any such breach, default or
noncompliance, or any acquiescence therein, or of or in any similar breach,
default or noncompliance thereafter occurring. It is further agreed that any
waiver, permit, consent or approval of any kind or character on any Purchaser's
part of any breach, default or noncompliance under this Agreement, the Related
Agreements or under the Charter or any waiver on such party's part of any
provisions or conditions of the Agreement, the Related Agreements, or the
Charter must be in writing and shall be effective only to the extent
specifically set forth in such writing. All remedies, either under this
Agreement, the Related Agreements, the Charter, by law, or otherwise afforded to
any party, shall be cumulative and not alternative.

          6.8  Waiver of Conflicts.  Each party to this Agreement acknowledges
that legal counsel for the Company, Cooley Godward LLP ("Cooley Godward"), has
in the past performed and may continue in the future to perform legal services
for one or more of the Purchasers or their affiliates in matters unrelated to
the transactions contemplated by this Agreement, including, but not limited to,
the representation of the Purchasers in matters of a similar nature to the
transactions contemplated herein.  Each party to this Agreement hereby (a)

                                      11.
<PAGE>

acknowledges that they have had an opportunity to ask for and have obtained
information relevant to such representation, including disclosure of the
reasonably foreseeable adverse consequences of such representation; (b)
acknowledges that with respect to the transactions contemplated herein, Cooley
Godward has represented the Company and not any individual Purchaser or any
individual shareholder, director or employee of the Company; and (c) gives its
informed consent to Cooley Godward's representation of the Company in the
transactions contemplated by this Agreement and Cooley Godward's previous or
continuing representation of one or more of the Purchasers or their affiliates
in matters unrelated to such transactions.

          6.9   Notices.  All notices required or permitted hereunder shall be
in writing and shall be deemed effectively given: (a) upon personal delivery to
the party to be notified, (b) when sent by confirmed telex or facsimile if sent
during normal business hours of the recipient, if not, then on the next business
day, (c) five (5) days after having been sent by registered or certified mail,
return receipt requested, postage prepaid, or (d) one (1) day after deposit with
a nationally recognized overnight courier, specifying next day delivery, with
written verification of receipt. All communications shall be sent to the Company
at the address as set forth on the signature page hereof and to Purchaser at the
address set forth on Exhibit A attached hereto or at such other address as the
Company or Purchaser may designate by ten (10) days advance written notice to
the other parties hereto.

          6.10  Expenses.  Each party shall pay all costs and expenses that it
incurs with respect to the negotiation, execution, delivery and performance of
the Agreement.

          6.11  Attorneys' Fees. In the event that any suit or action is
instituted to enforce any provision in this Agreement, the prevailing party in
such dispute shall be entitled to recover from the losing party all fees, costs
and expenses of enforcing any right of such prevailing party under or with
respect to this Agreement, including without limitation, such reasonable fees
and expenses of attorneys and accountants, which shall include, without
limitation, all fees, costs and expenses of appeals.

          6.12  Titles and Subtitles. The titles of the sections and subsections
of the Agreement are for convenience of reference only and are not to be
considered in construing this Agreement.

          6.13  Counterparts. This Agreement may be executed in any number of
counterparts, each of which shall be an original, but all of which together
shall constitute one instrument.

          6.14  Broker's Fees. Each party hereto represents and warrants that no
agent, broker, investment banker, person or firm acting on behalf of or under
the authority of such party hereto is or will be entitled to any broker's or
finder's fee or any other commission directly or indirectly in connection with
the transactions contemplated herein.  Each party hereto further agrees to
indemnify each other party for any claims, losses or expenses incurred by such
other party as a result of the representation in this Section 6.14 being untrue.

                                      12.
<PAGE>

          6.15  Exculpation Among Purchasers. Each Purchaser acknowledges that
it is not relying upon any person, firm, or corporation, other than the Company
and its officers and directors, in making its investment or decision to invest
in the Company. Each Purchaser agrees that no Purchaser nor the respective
controlling persons, officers, directors, partners, agents, or employees of any
Purchaser shall be liable to any other Purchaser for any action heretofore or
hereafter taken or omitted to be taken by any of them in connection with the
Shares and Conversion Shares.

          6.16  Confidentiality. Each party hereto agrees that, except with the
prior written consent of the other party, it shall at all times keep
confidential and not divulge, furnish or make accessible to anyone any
confidential information, knowledge or data concerning or relating to the
business or financial affairs of the other parties to which such party has been
or shall become privy by reason of this Agreement or the Related Agreements,
discussions or negotiations relating to this Agreement or the Related
Agreements, the performance of its obligations hereunder or the ownership of the
Shares purchased hereunder. The provisions of this Section 6.16 shall be in
addition to, and not in substitution for, the provisions of any separate
nondisclosure agreement executed by the parties hereto.

          6.17  Pronouns. All pronouns contained herein, and any variations
thereof, shall be deemed to refer to the masculine, feminine or neutral,
singular or plural, as to the identity of the parties hereto may require.

          6.18  California Corporate Securities Law. THE SALE OF THE SECURITIES
WHICH ARE THE SUBJECT OF THIS AGREEMENT HAS NOT BEEN QUALIFIED WITH THE
COMMISSIONER OF CORPORATIONS OF THE STATE OF CALIFORNIA AND THE ISSUANCE OF SUCH
SECURITIES OR THE PAYMENT OR RECEIPT OF ANY PART OF THE CONSIDERATION THEREFOR
PRIOR TO SUCH QUALIFICATION OR IN THE ABSENCE OF AN EXEMPTION FROM SUCH
QUALIFICATION IS UNLAWFUL. PRIOR TO ACCEPTANCE OF SUCH CONSIDERATION BY THE
COMPANY, THE RIGHTS OF ALL PARTIES TO THIS AGREEMENT ARE EXPRESSLY CONDITIONED
UPON SUCH QUALIFICATION BEING OBTAINED OR AN EXEMPTION FROM SUCH QUALIFICATION
BEING AVAILABLE.


             [THE REMAINDER OF THIS PAGE INTENTIONALLY LEFT BLANK]

                                      13.
<PAGE>

     In Witness Whereof, the parties hereto have executed this Series B
Preferred Stock Purchase Agreement as of the date set forth in the first
paragraph hereof.

Company:                                Purchasers:

Blue Martini Software, Inc.

By: /s/ Monte Zweben                    By: /s/ All Series B Investors
   -------------------------------         ------------------------------------
   President
<PAGE>
                                   EXHIBIT A

                            SCHEDULE OF PURCHASERS

NAME AND ADDRESS
---------------------------------------

Marc Benioff

Daniel T. Doles

Peter Friedland and Rosalind Grymes-
Friedland, Trustees FBO Peter Friedland
and Rosalind Grymes-Freidland UTA
Dated July 26, 1995

Matrix Partners V, L.P.
2500 Sand Hill Road, Suite 113
Menlo Park, CA 94025
Attn: Andrew Verhalen

Matrix V Entrepreneurs Fund, L.P.
2500 Sand Hill Road, Suite 113
Menlo Park, CA 94025
Attn: Andrew Verhalen

Zuendt Family Trust, UTA
  August 28, 1996

Zweben Family Revocable Trust Dated
  October 17, 1997

--------------------------------------------------------------------------------

                  SERIES B PREFERRED STOCK PURCHASE AGREEMENT