Stocks rallied late in the session on Thursday for the second day as enthusiasm about strong profits offset lingering credit concerns, although a modest flight-to-quality bid gave bond prices a slight lift.

Wall Street's burst of buying and higher finish extended a global stocks rally that lifted benchmark share indexes in most major markets from London to Paris and Frankfurt, and from Shanghai to Tokyo. These gains helped stocks recover from a 3-1/2-month low hit earlier this week as investors once again focused on the healthy profit outlook.

At about 4:30 p.m. ET, U.S. Treasury bond prices gained moderately after the market got more bad news about the U.S. subprime mortgage market.

The dollar gained ground against the yen, but dipped against the euro as some currency investors held back ahead of the week's biggest data release, the U.S. July employment report due on Friday.

There is a real contest going on in the capital markets ... between the equity crowd, who look correctly at very solid corporate economic and fundamental underpinnings and wonder whether this valuation should be reset by credit risk, said Jack Malvey, chief global fixed-income strategist with Lehman Brothers, in New York.

On the other hand, there is a bond world where credit- risk reset has probably largely concluded, but there is a lot of post-storm damage, Malvey said, citing investors' concerns that there might be some additional hedge fund disclosures, which could put more pressure on credit markets.

Earnings have been overshadowed recently by worries about the global credit squeeze and its impact on stocks, especially mortgage and financial companies. That has led to several whipsaw sessions for stocks over the past few days.

QUICK BURST OF BUYING

But in the final 30 minutes of Thursday's regular trading session, stock investors put worries about the U.S. housing market and corporate debt to one side and pushed stocks abruptly higher.

The Dow Jones industrial average jumped 1.05 percent around 3:30 p.m. and climbed to a session high at 13,503.33. But by the closing bell, the Dow had trimmed some of that gain to end at 13,463.33 -- up 100.96 points, or 0.76 percent. The Standard & Poor's 500 Index finished at 1,472.20, up 6.39 points, or 0.44 percent. The Nasdaq Composite Index gained 22.82 points, or 0.89 percent, to close at 2,575.98.

In overseas trading, MSCI's main world equity index was up 0.3 percent after falling 7 percent from its July lifetime peak to a low on Wednesday.

The pan-European FTSEurofirst 300 index rose 10.71 points, or 0.7 percent, to end at 1,536.97, bouncing back from a 1.5 percent drop in the previous session.

In Tokyo, the Nikkei average gained 113.13 points, or 0.7 percent, to close at 16,984.11, after sinking 1.3 percent earlier in the session.

U.S. BONDS GET SUBPRIME BID

In the U.S. Treasury bond market, prices rose in mid-afternoon trading, helped by safe-haven bids as the subprime ABX indexes plummeted on renewed worries about bonds backed by mortgages made to borrowers with shaky credit.

By 4:30 p.m., the benchmark 10-year Treasury note was up 5/32 in price at 97-28/32 for a yield of 4.77 percent, down from 4.79 percent late on Wednesday. Bond prices move inversely to their yields.

Whenever you see credit concerns, the (Treasury) market goes up, said Carl Lantz, interest-rate strategist at Credit Suisse, in New York. The latest decline in the ABX indices has spread to even the highest-rated triple-A classes, he said.

The ABX BBB- 07-1 series, tied to risky loans made in last year's second half, fell precipitously to end the session at a record low of 35.63.

In line with the U.S. stock market's advance, the dollar rose against the yen and Swiss franc. But the euro and the sterling were little changed after the Bank of England and European Central Bank left rates on hold at 5.75 percent and 4 percent, respectively.

Late in New York, the dollar rose 0.34 percent to 119.24

yen from 118.84 yen late on Wednesday in New York. The euro gained 0.23 percent to $1.3700 from $1.3668 late on Wednesday in New York.

MORE VOLATILITY AHEAD

As investors weigh gloomy credit stories and strong corporate and economic fundamentals, equities, currencies and other global markets are likely to experience more sharp swings, strategists expect.

Economists and market analysts are keeping one eye on the crude oil price, still near the record high of $78.77 per barrel hit on Wednesday. After a choppy session, September crude gained 33 cents to settle at $76.86 a barrel on no sign of a production increase from OPEC. Some economists warn a sustained period of high oil and gasoline prices could curb U.S. consumer spending and slow the economy.

Some investors bought gold to diversify portfolios, traders said. COMEX most-active gold for December delivery gained 70 cents to settle at $676.60 an ounce.

(Additional reporting by Kristina Cooke, Richard Leong, Vivianne Rodrigues, Gertrude Chavez-Dreyfuss, Nancy Leinfuss, Lucia Mutikani, Gene Ramos and Frank Tang in New York; Blaise Robinson in Paris and Eriko Amaha in Tokyo)