* Economy shrinks in second quarter but at slower rate
* Insurer Travelers rises a day after upping forecast
* Dow up 0.2 pct; S&P 500 up 0.7 pct; Nasdaq off 0.3 pct
* S&P 500 in best five months since 1938
* For up-to-the-minute market news click [STXNEWS/US] (Updates to close)
By Edward Krudy
NEW YORK, July 31 (Reuters) - The S&P 500 ended its best five-month streak since 1938 with a slight gain on Friday as government data showed softness in consumer spending but reinforced expectations that the economic slump is abating.
But the mood was cautious as the report on second-quarter gross domestic product showed the U.S. consumer was more frugal, which cut hurt economic demand. Even so, Dow industrials had their best July since 1989 while the S&P 500 and Nasdaq recorded their best gains for July since 1997.
Commodity prices, a barometer for economic sentiment, moved higher after the GDP data, but the price of safe-haven U.S. Treasury debt also rose in a sign of underlying caution.
Trading was volatile as investors digested mixed news from the GDP report. Consumer spending, which fell in the quarter, is a crucial driver of corporate profits and the economy. <For related news click [ID:nN31416560]>.
GDP fell at a 1.0 percent annual rate in April-June after tumbling 6.4 percent in the first quarter. Economists had expected a 1.5 percent contraction in the second quarter.
"The GDP number came in better than expected but was masked by a lot of government spending and the consumer pulled back," said Jack Ablin, chief investment officer at Harris Private Bank in Chicago. "When you're fueling economic growth on government spending, clearly that is not a sustainable situation.
"But overall my take is that we still are going to enjoy a cyclical recovery and the third quarter will likely come in positive territory," he said.
The Dow Jones industrial average .DJI ended up 17.15 points, or 0.19 percent, at 9,171.61. The Standard & Poor's 500 Index .SPX was up 0.73 point, or 0.07 percent, at 987.48. The Nasdaq Composite Index .IXIC was down 5.80 points, or 0.29 percent, at 1,978.50.
For the week the Dow rose 0.9 percent, the S&P 500 gained 0.8 percent and the Nasdaq added 0.6 percent. For July the Dow gained 8.6 percent, the S&P added 7.4 percent and Nasdaq rose 7.8 percent.
Another report showing that business activity in the U.S. Midwest was the strongest in July in 10 months also lifted stocks. [ID:nN31422353].
"What you're seeing is numbers that are an improvement, but a lackluster improvement. They're less bad, but not great," said Chad Morganlander a portfolio manager at Stifel, Nicolaus & Co in Florham Park, New Jersey.
Travelers Cos Inc (TRV.N), one of the largest U.S. home, auto and commercial insurers, was a standout following positive broker comments, a day after it raised its forecast for the year. The stock jumped 2.7 percent to $43.07. [ID:nWNBB6634] [ID:nN29275022]
On the downside, Walt Disney Co (DIS.N) shed 4.2 percent to $25.12. The media and entertainment powerhouse reported a 26 percent slide in quarterly earnings late Thursday as the recession continued to hurt advertising and consumer spending. [ID:nN30376974]
Even though Disney beat expectations by a hair, its shares were the Dow's top drag. JPMorgan downgraded the stock to "underweight" from "neutral" on Friday. [ID:nBNG436715]
In other earnings news, Chevron Corp (CVX.N) posted a 71 percent drop in profit on weaker energy prices and fuel demand due to the economic slump, but it raised estimated 2009 output and said cost cuts were on track. The shares rose 2.6 percent to $69.47. See [ID:N30383356]
Volume was moderate on the New York Stock Exchange, with 1.51 billion shares changing hands, compared to last year's estimated daily average of 1.49 billion, while on the Nasdaq, about 2.27 billion shares traded, below last year's daily average of 2.28 billion.
Advancing stocks outnumbered declining ones on the NYSE by a 1879 to 1137, while declining stocks beat advancers on the Nasdaq by 1356 to 1282. (Reporting by Edward Krudy; Editing by Kenneth Barry)