U.S. stocks rallied Thursday, sending the Dow Jones industrial average to a record close, as strong profits from such companies as Bear Stearns Cos. (BSC) boosted optimism about the economy.

The Dow Jones industrial average gained 99.26 points, or 0.81 percent, to finish at 12,416.76 — a record closing high. The Standard & Poor's 500 Index jumped 12.28 points, or 0.87 percent, to end at 1,425.49. The Nasdaq Composite Index finished up 21.44 points, or 0.88 percent, at 2,453.85.

Click here to visit FOXBusiness.com's Investing Center.

The Dow notched its 19th record close since the beginning of October, closing above 12,400, while the S&P 500 hit a six-year high.

Stock investors defied a nearly 2 percent jump in oil prices after OPEC decided to cut more production in February, a step which contributed to gains among shares of energy companies such as Exxon Mobil (XOM) Corp.

Traders said investors were optimistic that earnings growth would withstand the downturn in the U.S. housing market.

"I believe it is the combination of decent economic news and decent company earnings reports (boosting stocks)," said Michelle Clayman, who oversees $6.1 billion as chief investment officer at New Amsterdam Partners in New York.

In addition, lower-than-expected weekly initial jobless claims data showed that the job market remained robust and helped bolster hopes about the outlook for consumer spending, she added.

Companies from financial services to retail to technology reported robust profits, including investment banks Bear Stearns and Lehman Brothers Holdings (LEH) Inc.

The two banks said a burst of merger activity contributed to quarterly profits that were stronger than forecast.

Bear Stearns' shares jumped 2.6 percent to $159.96 on the New York Stock Exchange. But since Lehman's earnings fell short of the bar set this week by rival Goldman Sachs, its stock slipped 0.4 percent to end at $76.08, also on the NYSE.

Costco Wholesale Corp. (COST), the largest U.S. warehouse club, and Ciena Corp. (CIEN), a telecommunications equipment provider, also posted higher quarterly profits.

Costco shares rose 1.8 percent to $54.11 on the Nasdaq, while Ciena jumped 11.5 percent to $27.83.

Also contributing to the Nasdaq's climb were shares of Microsoft Corp. (MSFT), which rose 1.8 percent to $30.07 after UBS raised its price target on the software maker to $34 from $33.

Shares of Exxon Mobil gained 1.8 percent to $78.73 on the NYSE, where another notable gainer was shares of fellow Dow component, diversified manufacturer General Electric Co. (GE), which this week boosted its dividend.

GE shares were the second-biggest advancer on the S&P 500 behind Exxon. They finished up 2 percent at $36.21.

Click here to visit FOXBusiness.com's Investing Center.