Updated from 4:10 p.m. EDT

Stocks had an up-and-down morning, but they went green at midday and closed higher Thursday as strong monthly retail sales outweighed more bad news out of the housing sector.

The

Dow Jones Industrial Average

advanced 57.88 points, or 0.44%, at 13,363.35, and the

S&P 500

rose 6.26 points, or 0.43%, at 1478.55. The

Nasdaq Composite

climbed 8.37 points, or 0.32%, to 2614.32.

Helping the major indices was a string of upbeat monthly retail sales spurred by the back-to-school shopping season.

Wal-Mart

(WMT) - Get Report

, the world's biggest retailer, surprised analysts after it said comp sales climbed 3.1% in August, twice as much as expected. The company also said same-store sales should climb 1% to 3% in September. Wal-Mart tacked on 31 cents, or 0.7%, to $42.76.

Rival

Target

(TGT) - Get Report

saw same-store sales jump 6.1% last month, also topping estimates, and said September's comp sales would likely be up between 4% and 6%. Target added $1.51, or 2.4%, to close at $63.39.

Among other retail winners,

Macy's

(M) - Get Report

said August same-store sales increased 2.4%, and

Abercrombie & Fitch's

(ANF) - Get Report

monthly comps were up 6%.

AnnTaylor's

(ANN)

same-store sales rose 2.9%, and

Nordstrom

(JWN) - Get Report

had a 6.6% rise in comp sales.

TST Recommends

On the losing side,

Kohl's

(KSS) - Get Report

said same-store sales slipped 0.6% last month.

Sharper Image

( SHRP) saw a 16% comparable-sales decline.

Despite the many stronger-than-expected reports, the S&P Retail Index fell 0.6% for the session. Among other decliners, the Amex Airline Index fell 1.1% and NYSE Financial Sector Index slipped 0.1%

On the winning side, the Philadelphia Gold & Silver Sector Index surged 5.7% as the price of gold topped $700 an ounce. Elsewhere, the Philadelphia Utility Sector Index gained 1.2% and the Philadelphia Semiconductor Sector Index rose 0.7%.

The major averages shook off weakness stemming from the Mortgage Bankers Association, which released a report that said 5.1% of the loans in its survey were delinquent in the second quarter and that the number of dwellings entering foreclosure hit a record high. Subprime delinquencies rose to 14.82%, the highest since the second quarter of 2002.

Ian Shepherdson, chief economist with High Frequency Economics, said there is a big difference between the subprime book in the second quarter of 2007 and that of five years ago.

"In the second quarter of 2002, there were 1.19 million subprime loans outstanding; now there are about 5.9 million," he said. "In other words, a 14.82% subprime delinquency rate now is equivalent to a 74% rate in 2002. That's why the problem now is so much worse despite similar headline delinquency rates."

On Wednesday, New York stocks plunged after the National Association of Realtors said its pending home sales index dropped 12.2% in July to a reading of 89.9, providing the latest evidence that the slowdown in housing is continuing.

The Dow fell 143.39 points, or 1.07%, to 13,305.47. The S&P 500 was down 17.13 points, or 1.15%, at 1472.29, and the Nasdaq was off 24.29 points, or 0.92%, at 2605.95.

In the new session, breadth turned around from Wednesday's weak levels. On the

New York Stock Exchange

, 2.79 billion shares changed hands Monday, as advancers topped decliners by an 5-to-3 margin. Volume on the Nasdaq reached 1.84 billion shares, with winners outpacing losers nearly 8 to 7.

Economic data were also in focus. The Labor Department said initial jobless claims dropped by 19,000 last week to 318,000. The latest data arrived a day before the closely watched jobs report. The government is expected to say that the U.S. economy added 120,000 jobs in August, compared with an increase of 92,000 in July.

"Given the level of apprehension, we could take advantage of any weakness," said Marc Pado, U.S. market strategist with Cantor Fitzgerald. "Gutsy traders should buy the close, hoping stocks rally on either low rates or solid jobs tomorrow."

St. Louis Fed President William Poole offered his thoughts about the health of the U.S. economy and job growth, noting that the labor market is strong and "operating near full employment."

In a separate report, the Labor Department said that second-quarter productivity was revised upward to a 2.6% gain from a preliminary reading of 1.8%, above expectations.

Also on the economic front, the Institute for Supply Management said the August reading for its services index came in at 55.8, unchanged from July and above estimates.

Treasury securities lost ground. The 10-year bond was down 11/32 in price, yielding 4.51%. The 30-year note was off 15/32 in price, yielding 4.80%.

Meanwhile, policymakers overseas made headlines. Both the European Central Bank and the Bank of England left their key interest rates unchanged at 4% and 5.75%, respectively. The ECB noted that monetary policy is still accommodative, but that volatility in the financial markets has led to uncertainty.

Similarly, the Bank of England said that it is too soon to judge the impact of the liquidity crisis on financial markets, but that there are tentative signs that consumer spending is slowing.

Earlier, the ECB injected more than $57 billion into the banking system as a measure to calm liquidity fears. Shortly after the opening bell, the Fed announced it added a total of $31.25 billion to its own system by way of a series of repurchase operations.

Paul Mendelsohn, chief investment officer with Windham Financial, said that the rate decision by the ECB and Bank of England should have no bearing on what the Fed will do at its Sept. 18 policy meeting.

"The Fed is in a different position than the ECB. European banks may be holding securities, but they're not the source of the mortgage problem," he said. "This credit problem is more of a problem for the U.S. economy than foreign economies. If the European central banks had cut rates, it would've made an impact. Leaving rates unchanged won't really affect us."

Elsewhere, the People's Bank of China, trying to keep a lid on inflation, raised the reserve requirements for banks for the seventh time in 2007. Now, 12.5% of deposits will have to be held in reserve, up from the prior 12%.

Major overseas markets were generally higher. London's FTSE 100, the Paris' CAC 40 and Germany's Xetra Dax were all up 0.5%. Overnight in Asia, Japan's Nikkei 225 added 0.6%, while Hong Kong's Hang Seng eased 0.1%.

Crude oil rose 57 cents to close at $76.30 a barrel after the Energy Department's weekly inventory report showed bigger-than-anticipated declines in gasoline and crude stocks. Also supporting higher prices was more violence in the Middle East, where Syria claims to have fired on Israeli aircraft that crossed its border.