* That the economy didn’t shrink as much as experts expected was enough to help stocks wrap up their best monthly performance in seven years, and send the Dow Jones industrial average yesterday to a fresh 2009 high.

The Dow closed out July posting an 8.6 percent gain for the month, after rising 17.15 to 9,171.61 yesterday. The Standard & Poor’s 500 index was largely flat at 987.48, but was up 7.4 percent for the month. The tech-heavy Nasdaq slipped 5.80 to 1,978.50, but was up 7.8 percent for July.

Helping lift stocks was a government report that showed the second-quarter gross domestic product (GDP) contracted just 1 percent on an annualized basis, less than analysts’ projections of a 1.5 percent decline.

However, that welcome news was tempered somewhat by the government’s revisions of first-quarter and 2008 fourth-quarter GDP, which showed contraction of 6.4 percent and 5.4 percent, respectively.

What’s more, the second-quarter figure means that the GDP has fallen four straight quarters, the longest since record keeping began six decades ago.

Economists say rising unemployment and more penny-pinching by consumers will hold down spending and business activity through the rest of the year and into early 2010.

Still, some analysts say there’s hope ahead.

“The recession looks to have largely bottomed in the spring,” said Joel Naroff, president of Naroff Economic Advisors. “Businesses have made most of the adjustments they needed to make, and that will set up the economy to resume growing in the summer.”

Meanwhile, the Commerce Department said the recession inflicted even more damage on the economy last year than the government had previously thought — growing in 2008 about 66 percent slower than was earlier estimated.

Separately, an International Monetary Fund report said a US economic recovery “is likely to be gradual” and that growth could be sluggish “for a considerable period.”

With unemployment already at a 26-year high of 9.5 percent and expected to grow worse, economists say businesses might cut more jobs and are unlikely to start hiring in the near term.

Treasuries gained as the government ended its record week of auctioning more than $200 billion in debt. The dollar remained weak against major currencies, falling against the euro to its lowest level for the year.