NEW YORK (TheStreet) -- After a series of dud days, the S&P 500 and Dow Jones Industrial Average closed the week with a bang. The markets shook off earlier losses to climb and climb into fresh record-setting territory after Greece and the eurozone came to a debt deal. 

The S&P 500 added 0.61% to 2,110 by Friday's close, while the Dow recovered its 18,000 level and then some, rising 0.86% to 18,140.7. Both indexes closed at new all-time highs. The Nasdaq added 0.6% to 4,955.97, its highest level in nearly 15 years. 

For the holiday-shortened week, the S&P 500 was up 0.64%, the Dow added 0.66%, and the Nasdaq gained 1.3%. 

Late in the trading day, Eurozone leaders and the Greek government agreed to a four-month extension of the debt-riddled nation's current bailout deal. A previous deadline on the debt package had been set to expire at the end of the month. Officials said Greece must submit a letter by Monday, detailing all reform measures it would make to remain compliant with current austerity conditions. 

Leaders have been in negotiation for a potential new debt package since last week. Earlier this week, Greece requested a six-month extension to its current loan but Germany rejected the request after Greece refused to adhere to previous austerity measures in place.

Benchmark indexes traded slightly lower earlier in the day, weighed down by uncertainty in the eurozone and poor earnings results from Deere (DE) and Noodles (NDLS) . Heavy machinery maker Deere was up 0.79%, recovering from earlier losses after it forecast a drop in sales on weaker demand in the global farm sector, particularly for agricultural machinery. Quarterly earnings of $1.12 a share slipped from $1.81 a share a year earlier.

Noodles plummeted more than 31% after missing analysts' estimates on its top- and bottom-lines. Comparable-restaurant sales increased 1.3% over the quarter.

The world's largest retailer, Wal-Mart (WMT) , was up 1% following a 3% drop on Thursday on light guidance and a quarterly revenue miss. Shares appeared unaffected by ratings revisions from Barclays and Goldman Sachs. Analysts at both firms predicted investments in labor would hurt profits.

Nordstrom (JWN) was up 6% despite reporting fourth-quarter profit of $1.32 a share, 3 cents short of estimates.

Sysco (SYY) was gaining despite news the Federal Trade Commission had filed a suit to oppose the proposed $3.5 billion takeover of U.S. Foods. "This proposed merger would eliminate significant competition in the marketplace," said FTC director Debbit Feinstein of the Bureau of Competition in a statement.

Business activity in the eurozone showed signs of increasing growth momentum. In February, the region's PMI rose to a seven-month high of 53.5, boosted by strength in Germany, its largest economy, and France. European markets were mixed with France's CAC 40 down, but Germany's DAX and the FTSE 100 in London posting modest gains.

West Texas Intermediate crude was down 2.4% to $49.94 a barrel. Oil services company Baker Hughes (BHI) said U.S. oil rigs fell by 37 to 1,019 over the week, a 28.5% drop from a year earlier. A week earlier, the firm reported a decline in oil rigs to their lowest level since August 2011 last week.

However, oil prices remain at half their mid-summer high as a drop in U.S. rig counts and a number of oilers cutting future investments isn't seen as enough to remedy global oversupply and tepid demand. On Thursday, the Energy Information Administration reported a sixth straight weekly increase in U.S. crude inventories, which were already at record levels.

The Markit manufacturing purchasing managers' index increased to 54.3 from 53.9 in January, its highest reading since November. Though higher, the reading reinforces recent data showing slower growth in the U.S. economy, particularly in its industrial and manufacturing sectors.

--Written by Keris Alison Lahiff in New York.