EXHIBIT 5.1 [LETTERHEAD] May 7, 1997 KLA-Tencor Corporation 160 Rio Robles San Jose, CA 95134 RE: REGISTRATION STATEMENT ON FORM S-8 Ladies and Gentlemen: We have examined the Registration Statement on Form S-8 to be filed by you with the Securities and Exchange Commission on May 7, 1997 (the "Registration Statement") in connection with the registration under the Securities Act of 1933, as amended, of an aggregate of 3,133,335 shares of your Common Stock, par value $0.001 per share (the "Shares") to be issued pursuant to the Tencor Instruments Second Amended and Restated 1984 Stock Option Plan, Tencor Instruments Amended and Restated 1993 Equity Incentive Plan, Tencor Instruments 1993 Nonemployee Directors Stock Option Plan, Tencor Instruments 1993 Employee Stock Purchase Plan, Tencor Instruments 1993 Foreign Subsidiary Employee Stock Purchase Plan, 1983 Employee Incentive Stock Option Plan of Prometrix Corporation and 1993 Employee Incentive Stock Option Plan of Prometrix Corporation (collectively, the "Plans"). As your counsel in connection with this transaction, we have examined the proceedings taken and are familiar with the proceedings proposed to be taken by you in connection with the issuance and sale of the Shares pursuant to the Plans. It is our opinion that, when issued and sold in the manner described in the Plans and pursuant to the agreements which accompany each grant under the Plans, the Shares will be legally and 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 and any amendments thereto. Very truly yours, WILSON SONSINI GOODRICH & ROSATI /s/ WILSON SONSINI GOODRICH & ROSATI