<DOCUMENT>
<TYPE>EX-5
<SEQUENCE>4
<FILENAME>a2100738zex-5.txt
<DESCRIPTION>EXHIBIT 5
<TEXT>
<Page>
                                                                       EXHIBIT 5

                                  [LETTERHEAD]
                  INTERNATIONAL BUSINESS MACHINES CORPORATION
           OFFICE OF THE VICE PRESIDENT AND ASSISTANT GENERAL COUNSEL
                             ARMONK, NEW YORK 10504

                                  January 21, 2003

    Ladies & Gentlemen:

    As Vice President, Assistant General Counsel and Secretary of International
Business Machines Corporation (the "Company") and an attorney duly admitted to
practice in the State of New York, I am giving this opinion in connection with
the proposed issuance and sale from time to time pursuant to Rule 415 under the
Securities Act of 1933 (the "Securities Act") of senior or subordinated debt
securities of the Company, to be issued under an Indenture dated as of
October 1, 1993, as supplemented by the First Supplemental Indenture thereto
dated as of December 15, 1995 (the "Senior Indenture"), between the Company and
JPMorgan Chase Bank, as successor to The Chase Manhattan Bank (National
Association) (the "Senior Trustee") or an Indenture (the Subordinated
Indenture") to be entered into between the Company and a Trustee (the
"Subordinated Trustee"), preferred stock (the "Preferred Stock") of the Company,
depositary shares (the "Depositary Shares") of the Company representing a
fractional interest in a share of Preferred Stock, capital stock (the "Capital
Stock") of the Company and/or warrants to purchase Debt Securities, Preferred
Stock or Capital Stock (the "Warrants") of the Company (the Debt Securities,
Preferred Stock, Depositary Shares, Capital Stock and Warrants are collectively
referred to herein as the "Securities").

    I, working together with competent members of my legal staff acting under my
direct supervision and control, have examined the Certificate of Incorporation
of the Company, as amended; the By-laws of the Company, the Senior Indenture;
and the forms of Subordinated Indenture and Deposit Agreement (the "Deposit
Agreement") filed as Exhibits to the Registration Statement. In addition, I am
familiar with the proceedings by which such instruments and the transactions
contemplated thereby were authorized by the Company.

    Based upon and subject to the foregoing, and assuming that: (i) the
Registration Statement and any amendments thereto (including post-effective
amendments) will have become effective and comply with all applicable laws;
(ii) the Registration Statement will be effective and will comply with all
applicable laws at the time the Securities are offered or issued as contemplated
by the Registration Statement; (iii) a Prospectus Supplement, Pricing Supplement
or term sheet will have been prepared and file with the Securities and Exchange
Commission describing the Securities offered thereby and will comply with all
applicable laws; (iv) all Securities will be issued and sold in compliance with
applicable federal and state securities laws and in the manner stated in the
Registration Statement and the appropriate Prospectus Supplement; (v) a
definitive purchase, underwriting or similar agreement with respect to any
Securities offered or issued will have been duly authorized and validly executed
and delivered by the Company and the other parties thereto; and (vi) any
Securities issuable upon conversion, exchange or exercise of any Security being
offered or issued will be duly authorized, created and, if appropriate, reserved
for issuance upon such conversion, exchange or exercise, I am of the opinion
that:

        (1) the Company has been duly incorporated and is a validly existing
    corporation under the laws of the State of New York.

        (2) with respect to Debt Securities to be issued under either the Senior
    Indenture or Subordinated Indenture, when (A) the Senior Trustee or
    Subordinated Trustee, as applicable, is qualified to act as Senior Trustee
    or Subordinated Trustee, as applicable, under the Senior Indenture or
    Subordinated Indenture, as applicable, (B) the Senior Trustee or
    Subordinated Trustee, as applicable, has duly executed and delivered the
    Subordinated Indenture or Senior
<Page>
    Indenture, as applicable, (C) the Senior Indenture or Subordinated
    Indenture, as applicable, has been duly authorized and validly executed and
    delivered by the Company to the Senior Trustee or Subordinated Trustee, as
    applicable, (D) the Senior Indenture or Subordinated Indenture, as
    applicable, has been duly qualified under the Trust Indenture Act of 1939,
    as amended, (E) the Board of Directors of the Company or a duly constituted
    and acting committee thereof (such Board of Directors or committee being
    hereinafter referred to as the "Board") has taken all necessary corporate
    action to approve the issuance and terms of such Debt Securities, the terms
    of the offering thereof and related matters, and (F) such Debt Securities
    have been duly executed, authenticated, issued and delivered in accordance
    with the provisions of the Senior Indenture or Subordinated Indenture, as
    applicable, and the applicable definitive purchase, underwriting or similar
    agreement approved by the Board upon payment of the consideration therefor
    provided for therein, such Debt Securities will be validly issued and will
    constitute valid and binding obligations of the Company, enforceable against
    the Company in accordance with their terms (subject to applicable
    bankruptcy, insolvency, reorganization, fraudulent conveyance, moratorium or
    other similar laws in effect and subject to general principles of equity,
    regardless of whether such enforceability is considered in a proceeding in
    equity or at law);

        (3) with respect to shares of Preferred Stock, when both (A) the Board
    has taken all necessary corporate action to approve the issuance and terms
    of the shares of Preferred Stock, the terms of the offering thereof, and
    related matters, including the adoption of a Certificate of Amendment
    relating to such Preferred Stock (a "Certificate") and the filing of the
    Certificate with the Secretary of State of the State of New York, and
    (B) certificates representing the shares of Preferred Stock have been duly
    executed, countersigned, registered and delivered either (i) in accordance
    with the applicable definitive purchase, underwriting or similar agreement
    approved by the Board upon payment of the consideration therefor (not less
    than the par value of the Preferred Stock) provided for therein or
    (ii) upon conversion or exercise of such Security or the instrument
    governing such Security providing for such conversion or exercise as
    approved by the Board, for the consideration approved by the Board (not less
    than the par value of the Preferred Stock), then the shares of Preferred
    Stock will be validly issued, fully paid and nonassessable;

        (4) with respect to Depositary Shares, when (A) the Board has taken all
    necessary corporate action to approve the issuance and terms of the
    Depositary Shares, the terms of the offering thereof, and related matters,
    including the adoption of a Certificate relating to the Preferred Stock
    underlying such Depositary Shares and the filing of the Certificate with the
    Secretary of State of the State of New York, (B) the Deposit Agreement or
    Agreements relating to the Depositary Shares and the related Depositary
    Receipts have been duly authorized and validly executed and delivered by the
    Company and the Depositary appointed by the Company, (C) the shares of
    Preferred Stock underlying such Depositary Shares have been deposited with a
    bank or trust company (which meets the requirements for the Depositary set
    forth in the Registration Statement) under the applicable Deposit Agreement,
    and (D) the Depositary Receipts representing the Depositary Shares have been
    duly executed, countersigned, registered and delivered in accordance with
    the appropriate Deposit Agreement and the applicable definitive purchase,
    underwriting or similar agreement approved by the Board upon payment of the
    consideration therefor provided for therein, the Depositary Shares will be
    validly issued;

        (5) with respect to shares of Capital Stock, when both (A) the Board has
    taken all necessary corporate action to approve the issuance of and the
    terms of the offering of the shares of Capital Stock and related matters and
    (B) certificates representing the shares of Capital Stock have been duly
    executed, countersigned, registered and delivered either (i) in accordance
    with the applicable definitive purchase, underwriting or similar agreement
    approved by the Board upon payment of the consideration therefor (not less
    than the par value of the Capital Stock) provided for therein or (ii) upon
    conversion or exercise of any other Security, in accordance with the terms
    of such

                                       2
<Page>
    Security or the instrument governing such Security providing for such
    conversion or exercise as approved by the Board, for the consideration
    approved by the Board (not less than the par value of the Capital Stock),
    then the shares of Capital Stock will be validly issued, fully paid and
    nonassessable; and

        (6) with respect to the Warrants, when (A) the Board has taken all
    necessary corporate action to approve the creation of and the issuance and
    terms of the Warrants, the terms of the offering thereof, and related
    matters, (B) the Warrant Agreement or Agreements relating to the Warrants
    have been duly authorized and validly executed and delivered by the Company
    and the Warrant Agent appointed by the Company, and (C) the Warrants or
    certificates representing the Warrants have been duly executed,
    countersigned, registered and delivered in accordance with the appropriate
    Warrant Agreement or Agreements and the applicable definitive purchase,
    underwriting or similar agreement approved by the Board upon payment of the
    consideration therefor provided for therein, the Warrants will be validly
    issued.

    I understand that I may be referred to, as counsel who has passed upon the
validity of the Debt Securities or the issuance of the Preferred Stock,
Depositary Shares, Capital Stock or Warrants on behalf of the Company, in a
supplement to the Prospectus forming a part of the Registration Statement on
Form S-3 relating to the Securities filed with the Securities and Exchange
Commission pursuant to the Securities Act, and I hereby consent to such use of
my name in said Registration Statement and to the use of this opinion for filing
with said Registration Statement as Exhibit (5) thereto.

<Table>
<S>                                                      <C>
                                                         Very truly yours,

                                                                    /s/ DANIEL E. O'DONNELL
                                                             --------------------------------------
                                                                      Daniel E. O'Donnell
</Table>

                                       3

</TEXT>
</DOCUMENT>
