Stocks rose in volatile trading on Friday after France and Germany said they reached an outline agreement to aid debt-burdened Greece, while a gauge of future U.S. economic activity was stronger than expected.

French President Nicolas Sarkozy said there was no time to lose on agreeing on a program for Greece, suggesting a deal needed to be reached in July at the latest.

We want to go as quickly as possible without fixing a date, Sarkozy said after meeting in Berlin with German Chancellor Angela Merkel, adding that the pair had the same position on Greece.

A deal tied to new aid for Greece would ask that banks holding Greek debt voluntarily shoulder some of the burden. Greece's prime minister appointed a new finance minister to try to push through harsh economic reforms.

Yesterday everybody was frightened the Greek scenario was going to be 'Lehman Part 2,' and what sparked the market today was some relief from European leaders that they'll do what they can to avoid a credit crisis, said King Lip, investment officer at Baker Avenue Asset Management in San Francisco.

Investment bank Lehman Brothers' bankruptcy in 2008 helped send the global economy into recession.

Some fear a default in Greek bonds could spiral into a similar scenario.

The Dow Jones industrial average <.DJI> gained 76.78 points, or 0.64 percent, to 12,038.30. The Standard & Poor's 500 Index <.SPX> rose 7.75 points, or 0.61 percent, to 1,275.39. The Nasdaq Composite Index <.IXIC> added 5.80 points, or 0.22 percent, to 2,629.50.

If the S&P 500 and Dow hold on to gains, the indexes would record their first positive week in seven. The S&P 500 is almost 7 percent below a three-year high hit early last month.

Many on Wall Street consider it likely that the S&P 500 will test its 2011 low near 1,250.

I believe we'll break those lows, then everyone is going to panic and that's probably going to be a good point to enter the market, Lip said.

But he cautioned a Greek default would significantly alter that view.

A key measure of future U.S. economic activity rose more than expected in May to a record high, while U.S. consumer sentiment worsened more than forecast in June on continued pessimism about the economy. Worries about inflation eased modestly.

The Friday reports suggested the economy continued to spin its wheels in the second quarter, though there were some signs of optimism the recovery could regain momentum later in the year.

A lot of people have a double-dip scenario ingrained and the numbers today were pretty decent, said Baker Avenue's King Lip.

(Reporting by Rodrigo Campos; additional reporting by Ryan Vlastelica, Leah Schnurr and European bureaus; Editing by Kenneth Barry)