Stocks ended higher Wednesday after spending most of the day a narrow range as investors welcomed good earnings news from technology bellwether Intel Corp. and shrugged off an unexpected jump in the U.S. trade deficit.

The Dow Jones industrial average (search) rose 61.56 points, or 0.58 percent, to end at 10,617.78. The Standard & Poor's 500 Index (search) gained 4.71 points, or 0.40 percent, to close at 1,187.70. The Nasdaq Composite Index (search) was up 12.91 points, or 0.62 percent, to finish at 2,092.53.

Wednesday's gains, resulting mostly from late buying, followed a poor start to the year — on Tuesday, stock indexes carved out fresh lows for 2005.

Strength in technology helped offset a disappointing report from United Parcel Service Inc. and concerns about a widening of the U.S. trade deficit.

Intel (INTC) climbed 2.8 percent a day after the chipmaker reported better-than-expected quarterly results. That helped mute the impact of a sales warning from Advanced Micro Devices Inc. (AMD) on Monday.

Intel also increased its annual budget for spending on factories and chipmaking equipment — which boosted shares of semiconductor manufacturing equipment suppliers.

After the closing bell, Apple Computer Inc. (AAPL) posted a quarterly profit that more than quadrupled, on skyrocketing sales of its iPod digital music player and strong demand for its PowerBook notebook PCs.

Apple's stock, which ended up 90 cents, or 1.39 percent, at $65.46 on Nasdaq, was halted immediately after the market closed.

"It looks really good across the board in terms of the revenue and profit being above expectations," said Owen Fitzpatrick, head of the U.S. Equity Group at Deutsche Bank Private Wealth Management.

"I think this momentum that happened last year is going to continue," he added. "Apple is a name in technology that at least for the next couple of quarters will have the wind at its back."

Helping stocks higher were semiconductor companies, whose shares rose after Intel's report after Tuesday's closing bell. KLA-Tencor Corp. (KLAC) climbed 4.79 percent, or $2.03, to $44.45, and Novellus Systems Inc. (NVLS) gained 3.8 percent, or 98 cents, to $26.79, both on Nasdaq.

Intel was up 62 cents at $23.16, while AMD was up 16 cents at $15.02.

Shares of energy companies also gained. Exxon Mobil Corp (XOM) rose 1.5 percent, or 74 cents, to $50.59 and ChevronTexaco Corp. (CVX) gained 2 percent, or $1.09, to $52.49 as oil prices climbed.

Anxiety about Wall Street's slow start to the year has made some investors wary of making big bets as a number of companies prepare to release quarterly earnings, and a mixed bag of reports and outlooks did little to build confidence. It made for a confusing market on Wednesday, as stocks meandered in and out of positive territory, but most analysts remained upbeat about the prospects for 2005.

"The start of the year has been difficult, but at the end of the day I think the fundamentals of the economy are intact," said Brian Pears, head equity trader at Victory Capital Management in Cleveland. "The earnings season will probably shape up pretty well, so it seems the selling is based more on what happened in November and December than on the future. So for that reason I'm pretty bullish"

In Washington, the Commerce Department (search) said America's trade deficit soared to an all-time high of $60.3 billion in November, reflecting record levels for imports of everything from oil and consumer goods to farm products. The 7.7 percent rise from an imbalance of $56 billion in October beat the previous monthly record, and caught economists by surprise; they'd forecast a slight narrowing of the trade gap.

The news prompted weakness in the dollar, which dropped sharply against the euro and other world currencies after the deficit data was released. Treasury Secretary John Snow has said repeatedly that the Bush administration supports a "strong dollar" policy, but some analysts believe the U.S. government is content to see the dollar fall because it makes U.S. exports cheaper.

The unexpected widening in the trade gap also led to a bounce in gold and, initially, oil prices, which were also moving on the government's weekly report on fuel inventories. The Department of Energy (search) found a 3 million barrel drop in crude supplies, a deeper decline than analysts had expected, but a 1.9 million barrel build in distillate fuels, which include heating oil. Light, sweet crude for February delivery added 69 cents to settle at $46.37 per barrel.

But analysts say what might matter more for investors is the next batch of earnings reports, which could set the tone for the rest of 2005.

"I think if we can get some solid earnings numbers coming up, we can see which way the market wants to go," said Stephen Carl, head of equity trading at The Williams Capital Group. "Conversely, if there's a lot of disappointment in the reports, we'll see where we don't want it to go. We just have to play wait and see for a while."

Meanwhile, shares of United Parcel Service Inc. (UPS) slid 7.4 percent, or $6.12, to $77.18, after the company lowered its fourth-quarter earnings forecast, citing higher costs and an unexpected slowdown in post-Christmas package volume. Rival FedEx Corp. (FDX) was down 94 cents at $94.47after reiterating its outlook for the quarter, saying it had experienced a strong holiday season and continued to see favorable conditions and demand for its services.

Hospital operator HCA Inc. (HCA) surged 10 percent, or $4.02, to $43.70, after the company raised its profit forecast for the fourth quarter, thanks to lower than expected debt expenses and a reduction in its tax rate. HCA also reiterated its projected earnings for the 2005 year.

OfficeMax Inc. (OMX) tumbled 4.7 percent, or $1.42, to $28.88, after saying its earnings report would be postponed pending an internal accounting probe. The office supplies retailer also announced the resignation of its chief financial officer, who was stepping down after only two months on the job; the former CFO will return on an interim basis while OfficeMax seeks a permanent replacement.

Pharmaceuticals maker Mylan Laboratories Inc. (MYL) was up 40 cents at $17.57 after appearing to back away from a contentious bid to take over King Pharmaceuticals Inc. (KG). Citing King's plans to restate more than two years of earnings, Mylan said it is unlikely the company will be able to complete the $4 billion stock deal. King lost 81 cents to $11.18 on the news.

During the regular session, trading was active, with 1.56 billion shares changing hands on the New York Stock Exchange, above the 1.46 billion daily average for last year. About 2.25 billion shares were traded on Nasdaq, far above the 1.81 billion daily average last year.

Advancers outnumbered decliners on the New York Stock Exchange by about 3 to 2 and by about 8 to 7 on Nasdaq.

The Russell 2000 index, which tracks smaller company stocks, was up 1.66, or 0.27 percent, at 613.19.

Overseas, Japan's Nikkei stock average shed 0.75 percent. In Europe, France's CAC-40 lost 0.85 percent, Britain's FTSE 100 fell 0.73 percent and Germany's DAX index closed down 1.16 percent.

Reuters and the Associated Press contributed to this report.