Stocks rallied on Tuesday, bolstered by confidence the Federal Reserve will cut interest rates next week, another round of upbeat outlooks from technology companies, and solid sales from McDonald's Corp.

Climbing energy shares also helped all three major indexes rise more than 1 percent as U.S. crude oil futures hit a record high settlement after OPEC raised production by a nominal amount and supply worries grew after an attack on a Mexican pipeline. Exxon Mobil rose 2.5 percent to $86.94, the main driver of gains on the Dow and S&P 500.

McDonald's shares were among those leading gains on the Dow after the fast-food chain reported higher August sales at restaurants open at least 13 months. For details, see.

Fed Chairman Ben Bernanke, in a speech in Berlin, said nothing to change hopes for an interest-rate cut at the Fed's policy meeting on September 18 and stuck to the scheduled topic of global imbalances.

It's optimism about rate cuts, and hoping that the rate cuts are going to help jump-start the economy and make sure it doesn't slip into a deeper slowdown, said Giri Cherukuri, head trader at OakBrook Investments LLC in Lisle, Illinois.

The Dow Jones industrial average was up 180.54 points, or 1.38 percent, at 13,308.39. The Standard & Poor's 500 Index was up 19.79 points, or 1.36 percent, at 1,471.49. The Nasdaq Composite Index was up 38.36 points, or 1.50 percent, at 2,597.47.

Western Digital Corp, the No. 2 disk-drive maker, lifted its earnings and revenue forecast late on Monday on improved demand. Its earnings upgrade came a day after Intel Corp, the world's largest chip maker, raised its forecast.

Western Digital was up 4.4 percent at $23.40 on the New York Stock Exchange. Shares of Intel, a Dow component, rose 1.2 percent to $25.66 on the Nasdaq.

Shares of McDonald's climbed 3.2 percent to $51.76.

General Motors Corp. gained 4.6 percent to $30.54, which traders attributed to news reports that some of GM's newest models had strong enough demand to allow the car maker to scale back on costly customer incentives.

Rate-sensitive banking stocks also advanced. Citigroup Inc gained 1.6 percent to $46.01. Shares of Wells Fargo were up 2.8 percent at $36.12.

Shares of Boeing Co. rose 2.2 percent to $97.44, helping the Dow. The plane maker said it has been awarded a $1.1 billion U.S. Air Force contract.

Bernanke said last week the U.S. central bank is set to act to limit the impact of financial turmoil on the economy but will not bail out investors who made poor decisions.

Meanwhile, on Monday several Fed speakers warned financial turmoil has increased the risks facing the U.S. economy.

To help the credit markets, the Fed approved a 50-basis-point cut in the discount rate it charges banks for loans on August 17, and it also has made sizable injections of reserves into the financial system.

Trading was below average on the NYSE. About 1.31 billion shares changed hands versus last year's estimated daily average of 1.84 billion. On Nasdaq, about 1.77 billion shares traded, below last year's daily average of 2.02 billion.

Rising stocks outnumbered falling ones by a ratio of about 3 to 1 on the NYSE and by 2 to 1 on Nasdaq.