Updated with Dow historical figures, and Treasuries, stock and commodity prices

NEW YORK ( TheStreet) -- Stocks capped off a stellar July with a mellow trading session Friday after the government reported that the economy shrank again in the second quarter but not as badly as expected.

The Dow Jones Industrial Average rose 17.15 points, or 0.2%,to 9171.61, while the S&P 500 gained 0.72 points, or 0.07%, to 987.47. The Nasdaq Composite fell 5.8 points, or 0.3%, to 1978.5.

Look what the Dow did this month:
  • Best monthly performance percentagewise since October 2002.
  • Best July month in percentage terms since 1989 when it rose 9.04%.
  • Biggest July point gain in its history.

The day's action wasn't much, but the major indices had their best performance for a July in years. The Dow rose 8.6%, the S&P 500 added 7.4%, and the Nasdaq tacked on 7.8% for the month.

"The big picture is that the economy shows signs of life, and even when there is bad news, stocks seem to do well," says Ryan Detrick, senior technical strategist at Schaeffer's Investment Research. "No matter what's thrown at it, this market seems to want to work its way higher, and you have to look at that bullishly."

The bottom line, says Detrick, is that a lot of people are trailing the market, and there's still a lot of money that's going to be chasing it. Click below to hear my entire conversation with Detrick, including one area he's cautious about and a technical breakdown of the next key levels for the major indices.

Stocks got a slight afternoon boost Friday afternoon as the House voted to refresh funding for the "cash for clunkers" initiative, which offers car owners federal subsidies of up to $4,500 for trading in old cars for new, more energy efficient vehicles.

The economy has done "measurably better than we expected," said President Obama after the House vote, attributing the improvement to the American Recovery and Reinvestment Act.

"As far as I'm concerned, we won't have a recovery as long as we keep losing jobs," cautioned Obama."But history does show that you have to have economic growth before you have job growth." The latest GDP figure shows we're "moving in the right direction," he said.

The advance reading on GDP , the most anticipated economic data of the week, indicated national production shrank by 1% in the second quarter, which was less severe than expected. However, first- quarter GDP was revised to reflect a 6.4% drop rather than the previously reported 5.5% decline. GDP has now fallen for four straight quarters, the first time since government records started in 1947.

Perhaps helping investors to not think about that last thing, the Chicago purchasing managers index increased slightly more than expected to 43.4 from 39.9.
 Market Roundup

Among stocks, Bank of America ( BAC) rose 5.9% to lead the Dow, followed by Alcoa ( AA), Travelers ( TRV) and Chevron ( CVX), up at least 2.6%. Walt Disney ( DIS) was the worst performer on the index, losing 4.6% a day after its earnings.

Fresh earnings continued to roll out as Chevron said its profit tumbled 71% on falling oil and gas prices and demand, undercutting estimates.

American Electric Power ( AEP) topped profit expectations and reaffirmed 2009 guidance earlier in the morning, and Constellation Energy ( CEG) said revenue slid 19% but it still topped estimates and upped its full-year earnings guidance. Those stocks were up 1.1% and down 1.4%, respectively.

As for commodities, crude oil futures rose $2.51 to $69.45 a barrel, while gold added $18.50 to $955.80 an ounce.

Stocks overseas were mixed. In Europe, Frankfurt's DAX fell 0.5% and London's FTSE 100 edged down 0.4%. In Asia, Hong Kong's Hang Seng and Japan's Nikkei added 1.7% and 1.9%, respectively.

Longer-dated Treasuries were rising in price, falling in yield. The 10-year was up 28/32 to yield 3.5%, while the 30-year gained 1-18/32, yielding 4.32%.

-- Reported by Elizabeth Trotta in New York.

RealMoney Barometer Poll
1 What would best describe your stance heading into the coming week of trading?
Bullish
Bearish
Neutral
2 Which of these sectors do you think is set to move up in the coming week?
3 Which of these sectors do you think is set to move down in the coming week?

View the results without voting

More from Markets

Video: There Are Some Big Changes Coming to the PGA Championships in 2019

Video: There Are Some Big Changes Coming to the PGA Championships in 2019

Video: One-on-One With Pluralsight's CEO Following Its Successful IPO

Video: One-on-One With Pluralsight's CEO Following Its Successful IPO

CBS-Viacom Battle Comes to a Head; FDA Approves Novartis Migraine Drug --ICMYI

CBS-Viacom Battle Comes to a Head; FDA Approves Novartis Migraine Drug --ICMYI

Listen: Here's What You Need To Know About ETFs Today (Hint: They're on Fire!)

Listen: Here's What You Need To Know About ETFs Today (Hint: They're on Fire!)

Cramer and His Team Stick to Their Disciplines -- Even When It's Disappointing

Cramer and His Team Stick to Their Disciplines -- Even When It's Disappointing