By Chris Dieterich 

Stocks rose Thursday after upbeat reports from Apple and Facebook lifted technology shares.

The Dow Jones Industrial Average added 32 points, or 0.2%, to 16532, putting the blue-chip benchmark within striking distance from its all-time closing high. On Wednesday, the Dow closed 0.5% below its Dec. 31 record closing high of 16576.66.

The S&P 500 added six points, or 0.3%, to 1881. The tech-oriented Nasdaq Composite Index climbed 29 points, or 0.7%, to 4155.

Tech shares were the top-performing sector after Apple, the biggest U.S. company by stock-market value, late Wednesday reported better-than-expected fiscal-second-quarter earnings and revenue. Apple also increased its stock-buyback program, raised its dividend and announced a seven-for-one stock split, lifting shares 7.7% on Thursday.

Apple's report helped to soothe investors who have been hit hard in recent weeks by declines in fast-moving tech and biotechnology stocks. The Nasdaq finished Wednesday with a 2.4% loss over the past month.

Apple's report "certainly helps bring people back to the tech sector," said Robert Pavlik, chief market strategist at Banyan Partners, which oversees $4.5 billion in assets. It "refocuses them on the fact that there is still value to be had there," he said.

Facebook added 2.1% after the social network late Wednesday topped first-quarter earnings and revenue forecasts, as the company continued to capitalize on its users' shift to mobile devices.

Caterpillar led gainers in the Dow, up 3.3%, after exceeding earnings and revenue estimates.

With 41% of the S&P 500 having reported first-quarter results through midday Thursday, overall earnings per share are now seen falling 0.2% from year-ago levels, according to FactSet, compared with expectations of a 1.4% decline when earnings season started a little over two weeks ago.

After opening higher, stock briefly turned negative, with traders attributing the morning slip from opening gains on headlines about the Russian military launching exercises along Ukraine's border.

Gold futures jumped and other haven investments, such as Treasurys and the yen, also got a boost. These assets, which investors see as safer than stocks and other bets that are more sensitive to various risks, later pared gains.

Yousef Abbasi, New York-based market strategist at brokerage JonesTrading Institutional Services, said that after sharp declines in March and early April for previously highflying stocks, many short-term traders have itchy trigger fingers.

"The fast money is still on edge," Mr. Abbasi said. "There certainly is some tension out there: The market is holding near all-time highs, and when nerves set in, people take profits."

Falling prices for 10-year Treasury notes pushed up the yield to 2.702%, from 2.686% late Wednesday. Gold futures added 0.3% to $1,288.70 a troy ounce.

In deal news, Zimmer Holdings surged 13% after the company said it agreed to buy privately held orthopedic-device maker Biomet Inc. for about $13.35 billion in cash and stock.

Earlier in the week, William Ackman's Pershing Square Capital Management and Valeant Pharmaceuticals disclosed an offer to buy Botox maker Allergan, and GlaxoSmithKline and Novartis announced a series of transactions, including Novartis' $14.5 billion purchase of GlaxoSmithKline's oncology unit.

Investors digested mixed U.S. economic data. Initial claims for jobless benefits rose 24,000 to 329,000 in the latest week, versus expectations of 315,000. Separately, durable-goods orders in March increased 2.6% on the month, the biggest gain in four months, exceeding forecasts of a 2% rise.

In Europe, the Stoxx Europe 600 rose 0.3%. The German Ifo business sentiment index for April rose to 107.3 from 106.4 in March, topping forecasts of 105.9. European Central Bank President Mario Draghi said Thursday the central bank may consider broad-based asset purchases if consumer inflation remains too low.

Asian markets were mostly lower, with China's Shanghai Composite falling 0.5%, the fifth loss in six sessions, and Japan's Nikkei Stock Average shedding 1%.

Crude-oil futures added 0.7% to $102.18 a barrel, after suffering the biggest two-day decline in six weeks through Wednesday. The dollar fell against the euro and the yen.

In other corporate news, 3M slipped 1.1% after results came up a bit shy of forecasts.

Qualcomm slumped 4.2% after better-than-expected fiscal second-quarter earnings were overshadowed by disappointing revenue and a downbeat current-quarter earnings outlook.

General Motors gained 0.6% after reporting much better-than-expected first-quarter earnings, while United Parcel Service lost 1.7% after missing earnings estimates.

Write to Chris Dieterich at christopher.dieterich@wsj.com

Apple (NASDAQ:AAPL)
Historical Stock Chart
From Feb 2024 to Mar 2024 Click Here for more Apple Charts.
Apple (NASDAQ:AAPL)
Historical Stock Chart
From Mar 2023 to Mar 2024 Click Here for more Apple Charts.