U.S. stocks rose in the New York Stock Exchange's broadest rally in a decade on optimism that the economy's expansion will weather record oil and gasoline prices. Producers of raw materials led the gains.

The Standard & Poor's 500-stock index rose 17.64, or 1.6 percent, to 1113.05. The index had its largest increase since March 25 and erased its loss for the year. The Nasdaq composite index gained 41.67, or 2.2 percent, to 1964.65.

The Dow Jones industrial average added 159.19, or 1.6 percent, to 10,117.62. Every stock in the benchmark rose except for SBC Communications, which dropped 14 cents, to $24.05, after the company agreed to a five-year contract that guarantees the jobs of 100,000 union employees.

Almost five stocks advanced for every one that declined on the NYSE, with 2,802 issues rising and 571 falling. The ratio was the highest since April 5, 1994, according to Schaeffer's Investment Research in Cincinnati.

Shares of raw material producers rose as gold, silver and lumber prices gained. Alcoa, the world's biggest aluminum maker, climbed $1.17, to $31.37. U.S. Steel, the largest steelmaker in the Americas, rallied $1.21, to $30.34.

Newmont Mining, the world's biggest gold producer, jumped $1.04, to $39.80. Gold futures in New York have had their biggest three-session rally in nine weeks, as a decline in the dollar against the euro increased the metal's allure as a hedge against other dollar-denominated assets.

An index of energy companies added 2 percent. The index has advanced 8.3 percent this year, the biggest gain among the S&P 500's 10 industry groups. Exxon Mobil, the biggest publicly traded oil company, added $1.02, to $43.82, and was the biggest contributor to the S&P 500's gain.

The Saudi oil minister said crude at $30 to $34 a barrel in New York reflects the costs of investing and maintaining oil fields. Some members of the Organization of Petroleum Exporting Countries said they want prices at the top end or above the official OPEC target of $22 to $28. The high cost of natural gas prompted shares of U.S. coal companies to advance. Peabody Energy, the largest U.S. coal producer, climbed $2.58, to $50.33.

Other Indicators

* The New York Stock Exchange composite index rose 95.19, to 6429.32; the American Stock Exchange index rose 10.02, to 1195.88; and the Russell 2000 index of smaller-company stocks rose 13.67, to 565.39.

* On the NYSE, trading volume rose to 1.54 billion shares, from 1.22 billion on Monday. On the Nasdaq Stock Market, advancers outnumbered decliners by 5 to 2 and volume totaled 1.75 billion, up from 1.4 billion.

* The price of the Treasury's 10-year note rose 63 cents per $1,000 invested, and its yield fell to 4.73 percent, from 4.74 percent on Monday.

* The dollar fell against the Japanese yen and the euro. In late New York trading, a dollar bought 111.77 yen, down from 112.72 late Monday, and a euro bought $1.2115, up from $1.2016.

* Light, sweet crude oil for July delivery settled at $41.14, down 58 cents, on the New York Mercantile Exchange.

* Gold for current delivery rose to $388.30 a troy ounce, from $385.60 on Monday, on the New York Mercantile Exchange's Commodity Exchange.