* Deere hits record high on profit beat, lifts Caterpillar
* Autodesk among biggest gainers on S&P 500, Nasdaq
* Wal-Mart rises on rating upgrade
* Indexes up: Dow 0.9 pct, S&P 0.96 pct, Nasdaq 0.82 pct (Updates to late afternoon, adds commentary, changes byline)
By Sinead Carew
NEW YORK, May 19 (Reuters) - U.S. stocks rallied on Friday as strong corporate earnings lifted investors' spirits in a week dominated by uncertainty surrounding Donald Trump's U.S. presidency.
Wall Street's major indexes were down for the week and Nasdaq was set for its biggest weekly drop since mid-April after reports earlier this week that Trump tried to interfere in a federal investigation.
Trump left on Friday for his first foreign trip since taking office in the hopes of shifting the focus away from domestic controversies.
"You've had no Washington drama today and decent earnings," said David Joy, chief market strategist at Ameriprise Financial in Boston. "It's the cyclical parts of the market that are moving today and the defensives are lagging. With Washington not in the headlines, we can focus on the economy, and the economy is in good shape in our view."
The market has not fully regained the ground lost in Wednesday's selloff as investors continued to doubt whether Trump will be able to fulfill campaign promises for fiscal stimulus and tax reform.
At 2:42 p.m. EST (1842 GMT), the Dow Jones Industrial Average was up 186.75 points, or 0.9 percent, to 20,849.77; the S&P 500 gained 22.8 points, or 0.96 percent, to 2,388.52; and the Nasdaq Composite added 49.89 points, or 0.82 percent, to 6,105.02.
Strong quarterly earnings from companies such as Autodesk Inc and Deere & Co helped. Autodesk jumped 14.6 percent and was among the biggest percentage gainers on the S&P and the Nasdaq. The software maker reported better-than-expected quarterly revenue on Thursday.
Deere hit an all-time high of $122.24 and was last up 7.8 percent at $121.46 after the farm and construction equipment maker posted a better-than-estimated quarterly profit.
Deere helped lift Caterpillar Inc by 2.3 percent. General Electric Co was the S&P's top driver with a 2.4 percent rise.
Of the 452 S&P 500 companies that have reported so far, about 75 percent have topped earnings expectations. In a typical quarter, about 64 percent beat estimates, according to Thomson Reuters I/B/E/S.
All 11 major S&P 500 sectors were higher, with industrials , materials, energy and financials all gaining about 1 percent.
Energy shares were boosted by a 2 percent increase in oil futures on growing expectations that OPEC and other producing countries will agree at a meeting next week to extend crude output cuts.
Wal-Mart Stores Inc was up 1.6 percent at $78.80 after BMO upgraded the stock to "market perform" from "underperform." The move followed Wal-Mart's report on Thursday of higher-than-expected quarterly sales at established U.S. stores.
Advancing issues outnumbered declining ones on the New York Stock Exchange by a 4.69-to-1 ratio. On Nasdaq, a 2.23-to-1 ratio favored advancers.
The S&P 500 posted 23 new 52-week highs and eight new lows; the Nasdaq Composite recorded 76 new highs and 52 new lows. (Additional reporting by Yashaswini Swamynathan in Bengaluru; Editing by Anil D'Silva and Jeffrey Benkoe)