Stocks were on track for a weekly gain on Friday as a better-than-expected quarter from Applied Materials(AMAT) - Get Report alleviated worries over the health of the tech sector.

The S&P 500 was up 0.74%, the Dow Jones Industrial Average climbed 0.5%, and the Nasdaq added 1.3%.

Applied Materials rose 13% after beating second-quarter estimates and reporting a double-digit boost in orders. The chipmaker reported a 52% quarter-on-quarter orders gain, while earnings of 34 cents a share beat by 2 cents. Its third quarter also looks strong with expected sales growth of 14% to 18% quarter on quarter, far higher than consensus of 2% growth.

The tech sector has been hard hit over this earnings season with big misses from industry giants including Apple(AAPL) - Get Report and Alphabet(GOOGL) - Get Report .

Apple and Alphabet are holdings in Jim Cramer'sAction Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells AAPL or GOOGL?Learn more now.

However, the tech sector was the best performer on markets Friday. Large-cap tech companies including Apple, Alphabet, Microsoft(MSFT) - Get Report , Oracle(ORCL) - Get Report  and Intel(INTC) - Get Report were higher, while the Technology Select Sector SPDR ETF (XLK) - Get Report added 1.3%. 

Crude oil remained lower as the number of U.S. rigs drilling in oilfields held flat at 318, according to Baker Hughes data. Commodities climbed earlier in the week in relief on supply outages in Nigeria, reduced production in wildfire-stricken Alberta, Canada, and a bullish turn for a number of analysts. West Texas Intermediate crude oil was down 0.9% to $47.75 a barrel on Friday.

"Petroleum prices have turned modestly lower on book squaring ahead of today's June WTI contract expiration and the weekend, with some tendency toward profit taking off the week's gains," Timothy Evans, energy futures analyst at Citi, wrote in a note.

Sales of previously owned homes increased 1.7% in April to a seasonally adjusted annual rate of 5.45 million, according to the National Association of Realtors. Analysts had expected a pace of 5.41 million. A housing shortage and higher prices is pressuring the market, though demand remains robust.

Markets saw relief on Friday as investors came to terms with the increased likelihood of a rate hike in June. Minutes from the Fed's April meeting released on Wednesday suggested many members would be comfortable raising rates as soon as next month, more quickly than even the most hawkish of economists' forecasts. A June rate hike now has a 30% probability, according to CME Group. The likelihood had been priced in at less than 10% chance at the beginning of May.

"The recent improvement in consumption and inflation data out of the U.S., in context of the recent April FOMC minutes, has market participants rapidly scaling up the chances of a rate hike in June," said Christopher Vecchio, currency analyst at DailyFX. 

Deere& Co.(DE) - Get Report was lower after a challenging second quarter. The farm machinery maker reported a 28% decline in profit and 4% slide in revenue, a reflection of the "downturn in global farm economy." The company expects equipment sales to drop 9% in fiscal 2016.

Gap(GPS) - Get Report climbed after announcing plans to shut down all 53 of its Old Navy stores in Japan and a number of international Banana Republic stores as part of its streamlining efforts. The closures will result in annual pretax savings of $275 million. The retailer also reported in-line first quarter results.

Foot Locker(FL) - Get Report  dropped following a mixed first quarter. The shoe retailer earned $1.39 a share over the quarter, as analysts expected, while sales climbed 3% to $1.99 billion. However, top-line growth fell just short of estimates of $2 billion. Same-store sales growth of 2.9% missed forecasts of 4.5%.

Brocade Communications (BRCD) fell after reporting disappointing revenue in its second quarter. The networking-tech company reported a 4.3% decline in sales to $523 million, falling short of estimates by $7.5 million. Earnings of 22 cents a share was in line with consensus.

Campbell Soup(CPB) - Get Report inched higher after topping quarterly profit and raising full-year earnings guidance. The canned goods company expects full-year adjusted earnings between $2.93 and $3 a share, up from a previous range of $2.88 to $2.96 a share. Campbell reaffirmed expected full-year sales down 1% to flat.

InterOil (IOC) surged after Oil Search agreed to acquire the Papua New Guinea oil company in a deal worth $2.2 billion. Australia's Oil Search shares were on watch.

Dick's Sporting Goods(DKS) - Get Report was upgraded to buy from neutral with a $53 price target at Goldman Sachs. Analysts said the company is best positioned to gain market share from Sports Authority, which is currently closing all its stores.

Lowe's(LOW) - Get Report was upgraded to buy with a $90 price target at Citigroup. The firm said the DIY retailer was leveraged to higher industry spending.