Trading nonetheless remained cautious ahead of the key April employment report on Friday.
The market has been staging a seemingly unstoppable advance over the past two months, with the Dow Jones Industrial Average rising in 22 out of the past 25 sessions, its longest winning streak since 1929.
"This is a market full of contradictions," said Barry Ritholtz, chief market strategist at Ritholtz Research & Analytics. "I can't recall the last time there's been such negative sentiment [in investor surveys], and yet we rarely reach a top in a market until everyone has become too optimistic."
The Dow industrials gained 29 points to 13,241, lifted by gains in shares of American Express Co. , Exxon Mobil Corp. , Microsoft Corp. and Pfizer Inc. .
Leading the advance, Verizon Corp. rose 3.7% after competitor Vonage Holdings Corp. was denied a request for a retrial in the patent-infringement it brought against Verizon.
The blue-chip average's rally has corresponded with market expectations that global growth is sustaining earnings growth for U.S. companies, even as the U.S. economy continues to slow.
"Likewise, the sectors of the market that tend to have high exposure to non-U.S. earnings streams, such as technology, industrials, energy and basic materials, all have been performing quite well," said Bob Doll, global chief investment officer at Blackrock Inc.
Elsewhere on the Dow, GM fell 5.4% after its quarterly results widely missed forecasts, hurt by its unit GMAC's losses in the subprime mortgage market.
IBM , also in the Dow, gained 0.6% after saying it has used a nanotechnology process to make computer chips for the first time in a production setting, advancing the race to boost the power and energy efficiency of semiconductors.
The S&P 500 was up 6.5 points at 1,502, crossing the key 1,500 level for the first time since September 2000.
The Nasdaq Composite rose 7.6 points to 2,565.
Trading volumes showed 1.6 billion shares exchanging hands on the New York Stock Exchange and 2.1 billion on the Nasdaq stock market. Advancing issues outpaced decliners by 18 to 13 on the NYSE, while decliners outpaced gainers by 15 to 14 on the Nasdaq.
By sector, airlines , transportation and software led the gains. Meanwhile, biotechnology and utilities were among the few sectors falling.
Looking on the bright side
While the U.S. economy has shown clear signs of slowing, professional investors have kept riding the market's upward momentum, seizing on not-as-bad-as-expected news to justify their gains, according to Ritholtz.
"The economy is decelerating and profits are decelerating. But we don't have the conditions in place [in the market] that suggest the run is over," he said.
The market received a boost before the open, after new data showing stronger-than-expected productivity and below-forecast labor costs.
Investors have been concerned that persistent inflationary pressures would prevent the Federal Reserve from cutting interest rates to stave off a hard landing of the economy.
The Labor Department said productivity of the U.S. non-farm business sector rose at a 1.7% annual rate in the first quarter, well above a MarketWatch forecast of a 0.8% gain.
"It's obviously good news that wage pressure was contained," said Peter Cardillo, chief market economist at Avalon Partners. "So far we've had pretty good surprises, showing the economy growing at a moderate pace and escaping negative growth."
Unit labor costs -- a key inflationary signal -- rose at an annual rate of 0.6% in the first quarter. This was well below expectations of a 2.1% increase.
Investors also were hertened after the Institute of Supply Management said its service-sector index rose to a higher than expected level of 56% in April from 52.4% in March. Economists expected the index to rise to 53.3%.
On Wednesday stocks rallied, lifting the Dow Jones Industrial Average to a record, thanks to deal speculation in the media sector, stronger-than-expected factory data, and Time Warner Inc.'s earnings report.
Stocks in motion
CBS Corp.'s rose 0.5% after its quarterly profit fell 5.9% but its adjusted earnings per share were a shade above analysts' expectations.
In other corporate news, Russia's Norilsk Nickel, the world's largest nickel producer, offered to buy Canada's LionOre Mining International for C$5.3 billion ($4.8 billion), or C$21.50 per share, in cash, seeking to break up Xstrata's agreement to buy the company. The offer price trumps Xstrata's offer of C$18.50 a share.
Treasury prices pared gains after the productivity report. The bond market responds positively to signs of contained inflation, but is made skittish by indications of strong productivity, which tend to diminish interest in low-risk assets.
The 10-year benchmark Treasury note fell 6/32 to 99-20/32 with a yield of 4.674%.
The dollar advanced against the euro and the yen after the data.
Crude-oil futures were erratic, as news of fresh violence at oil installations in Nigeria offset some of the pressure from a U.S. supply report that showed a second weekly rise in crude inventories. The June crude contract still finished down 53 cents at $63.15 a barrel.
In addition, a fire forced the partial closure of an Exxon Mobil refinery with a capacity of 115,000 barrels a day.
The June gold futures contract rallied $7.20 to close at $682.30 an ounce, recouping the previous session's losses.
By Nick Godt