U.S. stocks retreated from a broad rally on Tuesday, undermined by rising oil prices and doubts about the success of Greece's second bailout, after the Dow Jones industrial average rose above 13,000 for the first time in nearly four years.

The euro was little changed late in the day after hitting nearly two-week highs against the U.S. dollar overnight on news that European finance ministers approved the 130 billion euro bailout plan, avoiding the threat of a disorderly debt default.

The Dow has gained more than 6.0 percent so far this year, while the broad Standard & Poor's 500 Index is up more than 8.0 percent year-to-date. Since October lows, both gauges have gained 25 percent in a rapid advance.

We're running into some minor selling pressure given the extent of the rally we've seen, said Fred Dickson, chief market strategist at D.A. Davidson & Co. in Lake Oswego, Oregon.

The Dow Jones industrial average <.DJI> closed up 15.82 points, or 0.12 percent, at 12,965.69. The Standard & Poor's 500 Index <.SPX> ended up 0.98 points, or 0.07 percent, at 1,362.21. The Nasdaq Composite Index <.IXIC> closed down 3.21 points, or 0.11 percent, at 2,948.57.

High oil prices also gave investors reason to sell stocks, as U.S. oil prices closed at a 9-month high. Top Asian consumers moved to cut crude purchases from Iran, following Western sanctions designed to limit the country's nuclear program.

U.S. crude for March delivery, which expires at the close of floor trading on Tuesday, settled up $2.26 at $105.50, after earlier hitting $106.07, the highest intraday since May 5.

In London, Brent crude futures settled up $1.61 at $121.66 a barrel.

The euro rose and then retreated against the dollar after Europe finally sealed a rescue deal for Greece, prompting investors to pare positions against the single currency despite doubts about the deal's implementation.

The euro traded down 0.1 percent at $1.3233. Earlier, it hit a session high of $1.3292 in the overnight session.

Being short the euro is a stale position right now, said Douglas Borthwick, managing director and head of trading at Faros Trading in Stamford, Connecticut. Many had questioned whether or not Greece would stay in the EUR, but last night's decisions were a resounding vote of 'yes.'

After 13 hours of talks, euro zone ministers agreed on the Greek deal early Tuesday by forcing Athens to commit to unpopular budget cutbacks and getting private bondholders to accept deeper losses on their holdings.

European shares ended lower in thin volume, with investors cashing in on recent highs, after the bailout failed to soothe concerns about the future of Greece, the euro zone's most troubled country.

While the agreement averted the danger of a disorderly Greek default, the country faces further political and economic hurdles.

The FTSEurofirst 300 index <.FTEU3> of pan-European shares fell 0.5 percent to 1,085.38 points, retreating after a two-day winning streak fuelled by expectations the Greek bailout deal was imminent.

The MSCI world equity index <.MIWD00000PUS> slipped by 0.2 percent, but is still more than 10 percent higher for the year to date.

U.S. Treasury prices fell after the Greek bailout dented appetite for safe-haven assets. However, concern over how Athens will implement the austerity measures moderated losses.

The benchmark 10-year U.S. Treasury note was down 18/32 in price to yield 2.06 percent.

The bailout for Greece averts a disorderly default next month, which potentially could have disrupted financial markets worldwide -- but it leaves major doubts over the prospects for implementation, given looming elections in April and rising social unrest on the streets of Athens.

Greece is increasingly trapped in a vicious circle where ever more austerity comes with an ever higher price tag on growth. Consequently, implementation risk will remain high, analysts at French bank Societe Generale said in a note.


Euro zone crisis in graphics: http://r.reuters.com/hyb65p

Portugal and Italy bond spreads: http://link.reuters.com/mac36s


Gold rallied to its highest level in more than two weeks on the Greek deal.

U.S. COMEX April futures settled at $1,758.50 an ounce, up $32.60 from Friday's close as traders returned after the U.S. Presidents Day holiday on Monday.

(Additional reporting by Julie Haviv, Frank Tang, Caroline Valetkevitch and Chris Reese; Editing by Leslie Adler and Andrea Evans)