Exhibit 5.1 May 11, 1998 KLA-Tencor Corporation 160 Rio Robles San Jose, CA 95134 RE: REGISTRATION STATEMENT ON FORM S-3 Ladies and Gentlemen: We have examined the Registration Statement on Form S-3 to be filed by you with the Securities and Exchange Commission on or about the date hereof (the "Registration Statement") in connection with the registration under the Securities Act of 1933, as amended, of up to 1,800,000 shares of your Common Stock (the "Shares"). All of the Shares are issued and outstanding and may be offered for sale for the benefit of the selling stockholders named in the Registration Statement. We understand that the Shares are to be sold from time to time on the Nasdaq National Market at prevailing prices or as otherwise described in the Registration Statement. As your legal counsel, we have also examined the proceedings taken by you in connection with the issuance of the Shares. We assume that the consideration received by you in connection with each issuance of Shares will include an amount in the form of cash, services rendered or property that exceeds the greater of (i) the aggregate par value of such Shares or (ii) the portion of such consideration determined by the Company's Board of Directors to be "capital" for purposes of the Delaware General Corporation Law. Subject to the foregoing, we are of the opinion that the Shares are validly issued, fully paid and non-assessable. We consent to the use of this opinion as an exhibit to the Registration Statement and further consent to the use of our name wherever appearing in the Registration Statement, including the Prospectus constituting a part thereof, and any amendments thereto. Very truly yours, WILSON SONSINI GOODRICH & ROSATI Professional Corporation /s/ WILSON SONSINI GOODRICH & ROSATI