The benchmark S&P 500 index briefly turned negative on Friday, while both the Dow and the Nasdaq trimmed earlier gains, as investors fretted about the economy's recovery prospects following a mixed report on second-quarter gross domestic product.

While the U.S. economy shrank at a less-than-expected 1.0 annual rate in the second quarter, data also showed a decline in consumer spending, a key driver of corporate profits, fanning worries that the recovery would be weak.

The Dow Jones industrial average <.DJI> rose 7.86 points, or 0.09 percent, to 9,162.32. The Standard & Poor's 500 Index <.SPX> climbed 0.13 points, or 0.01 percent, to 986.88. The Nasdaq Composite Index <.IXIC> added 2.28 points, or 0.11 percent, to 1,986.58.

(Reporting by Ellis Mnyandu; editing by Jeffrey Benkoe)