Updated from 4:39 p.m. EDT

The U.S. stock market had a sluggish morning, but by Wednesday's close the major indices had made their way into positive territory as energy shares rose and financials rebounded.

The

Dow Jones Industrial Average

gained 40.30 points, or 0.4%, to 11,656.07, and the

S&P 500

was up 4.31 points, or 0.3%, at 1289.19. The

Nasdaq

was higher by 28.54 points, or 1.2%, to 2378.37.

One day ago, the Dow, the S&P and the Nasdaq all surged thanks to falling crude, decent data on the services sector and comments from the

Federal Reserve

that traders viewed as friendly for equities. At the end of the day, all three had jumped more than 2.8%.

When the new session arrived, investors opted to lock in some of their gains. Financial stocks were among the notable early decliners, but they gradually made headway and ended little changed.

Merrill Lynch

(MER)

recovered from a loss and rose 1%.

Lehman Brothers

(LEH)

rebounded to add 1.1%.

On the winning side was the Amex Oil Index, up 2.6%, led by

Anadarko

(APC) - Get Report

and

Valero

(VLO) - Get Report

.

Corporate earnings continued to arrive at a rapid clip, and on the early side

Transocean

(RIG) - Get Report

,

Qwest

(Q)

and

Agrium

(AGU)

exceeded estimates.

Freddie Mac

(FRE)

, meanwhile, missed expectations.

Grocery-store operator

Whole Foods

(WFMI)

sank to a 52-week low after it had a disappointing quarterly profit and said it would halt its dividend. Shares closed down 13% at $20.04.

Microsoft

(MSFT) - Get Report

was another story stock, adding 3% following a Bloomberg report that cited a UBS analyst who believes the software maker might be close to announcing a stock buyback worth up to $20 billion.

Away from equities, crude oil shed another 72 cents to $118.45 a barrel. Gold lost $3.10 to $883 an ounce.

Treasury prices fell. The 10-year note was down 9/32 in price, yielding 4.05%, and the 30-year bond was lower by 19/32, yielding 4.68%. The dollar was advancing against its major counterparts.

Get your daily dose of Jim Cramer and all the stocks in his head. Sign up for the free Daily Booyah! newsletter by clicking here

.

This article was written by a staff member of TheStreet.com.