Apple keeps tech stocks afloat

u.s. stocks, nasdaq
Click the chart for more stock market data.

U.S. stocks mostly ended in the red Wednesday afternoon, but a tech stock rally fueled by Apple's better-than-expected earnings limited the losses.

Apple (AAPL), one of the most widely-held stocks, often has an outsized impact on the overall tech sector as well as the broader market. Its 5% rise helped the tech-heavy Nasdaq finish just above the flat line Wednesday. A 7% jump in shares of Electronic Arts (EA) on the back of an earnings beat also helped.

Meanwhile, the Dow Jones industrial average and the S&P 500 slipped slightly, dragged down by Caterpillar (CAT), Broadcom (BRCM) and AT&T (T). All three delivered results short of Wall Street's forecasts.

Caterpillar also lowered its earnings and sales outlook for the year, which sent its stock 2.4% lower. The heavy equipment manufacturer's stock was the biggest loser in the Dow.

The drop in the two indexes comes after the Dow closed at a record high Tuesday, while the S&P 500 remained near its record high. Both have gained more than 18% so far this year, as has the Nasdaq.

Click here for more on stocks, bonds, currencies and commodities

Stocks have been grinding higher in recent days because investors took solace from mostly improved earnings. Overall, corporate earnings have been better than anticipated, although revenue growth remains modest.

More than a third of the companies in the S&P 500 have reported second-quarter results. So far, more than 65% have topped analysts' low expectations, according to S&P Capital IQ.

After the closing bell, Facebook (FB) reported solid earnings thanks to strong mobile ad revenue. Shares of the social media giant soared in after-hours trading.

Pepsi pops, but soda sales sag
Pepsi pops, but soda sales sag

Aside from earnings, Dell (DELL) said it has received a revised offer from founder Michael Dell, and would be holding a special meeting Aug. 2 to consider its options.

Apparel company Hanes Brands (HBI) said it reached an agreement to buy Maidenform Brands (MFB) in an all-cash deal worth $575 million.

On the economic front, the Commerce Department said new home sales rose to a five-year high, with an annual rate of 497,000 in June, up 8.3% from May. Economists had expected an annual rate of 483,000.

Related: Fear & Greed Index, still greedy

European markets ended modestly higher after the latest eurozone purchasing managers' index showed the region was stabilizing. Manufacturing output grew for the first time since February 2012, while the service sector saw its smallest rate of decline for 18 months.

"The hope for the eurozone is that rising confidence encourages businesses to pare back job cutting and become more prepared to invest," said Howard Archer, chief European economist at IHS Global Insight.

Related: Factory output puts brakes on China's growth

Meanwhile, Asian markets had a mixed day after HSBC said Wednesday that its "flash" index of Chinese manufacturing purchasing managers' sentiment fell to an 11-month low in July.

CNNMoney Sponsors