The price of oil settled at $106.25, up $2.65 for the day and its highest level since last May. The price jumped more than $1 in about 20 minutes after Iran's foreign ministry spokesman told reporters that a U.N. team visiting Iran has no plans to inspect the country's nuclear facilities and will only hold talks with Iranian officials.
"That was the olive branch the market was holding onto," said Phil Flynn, an analyst for the brokerage PFGBest. "If they're not going to discuss the nuclear program, then we're a lot closer to a conflict than further away," he said.
Airline stocks got clobbered. United Continental lost 9 percent, Delta Air Lines 7 percent. The Dow transportation average lost 1.5 percent.
Materials, telecommunications and energy companies led the industries gaining ground. Health care companies, makers of consumer staples and utilities, traditionally stocks to own in more cautious times, were lower.
The Standard & Poor's 500 index surpassed 1,363, its peak from April 2011, during the day but closed at 1,362.21, up 0.98 point. The Nasdaq composite, which is heavy with technology stocks and trading at levels not seen since December 2000, closed down 3.21 points at 2,948.57.
Metals prices jumped because of expectations that demand may improve after the Greek bailout package was approved and China took another step to stimulate economic growth. Silver finished up 3.7 percent, and platinum, copper and palladium all rose 3 percent or more. Gold ended up 1.9 percent.
The Dow last closed above 13,000 on May 19, 2008. The next day, it crossed under 13,000, not to return for almost four years. It fell as low as 6,547 on March 9, 2009. A reading of 13,094 would double that.
Dan McMahon, director of equity trading at Raymond James, called the 13,000 mark "just a big round number" as a matter of market fundamentals. But he added: "Psychologically, it matters."
The milestone could motivate cautious investors to pump more money back into the stock market. The yield on the government's benchmark 10-year Treasury note rose to 2.06 percent from 2.01 percent Friday, a sign that fewer investors wanted the bonds and were instead willing to buy riskier stocks.
"You need notches along the way to measure things," and Dow 13,000 is as good as any, said John Manley, chief equity strategist for Wells Fargo's funds group. "Is 50 older than 49 and a half? Yes, by six months. Do those six months really make a difference? Probably not. But it does give us a fixed point, something we can look at."
The Dow is also an imperfect measure of the economy's health. It is made up of just 30 companies, and it's weighted so that the few with the highest stock prices carry the most heft.
A small percentage change in the stock of IBM, which is trading around $193, sways the index much more than a large change in the stock of Bank of America, which is trading around $8.
Last year, the Dow rose 5.5 percent. But strip out IBM and McDonald's, the two stocks with the highest prices last year, and it rose just 1.8 percent, according to calculations by Birinyi Associates.
Dow Jones, which decides which 30 companies are the best barometer, says the index can accurately represent the economy because the 30 stocks make up 25 to 30 percent of the market value of all U.S. public companies.
Among the big movers:
— Barnes & Noble fell 4 percent after missing expectations. Rising costs offset higher sales of both traditional books and digital books. The bookstore chain, a survivor in an era that has felled competitors like Borders and Waldenbooks, plans to introduce a cheaper Nook to compete with Amazon's Kindle Fire.
— J.C. Penney, which is trying to reinvent itself and just brought in an Apple veteran as CEO and changed its logo, fell 3 percent after Fitch Ratings dropped its credit grade to junk status.
— High-end department store Saks rose 3 percent after beating analysts' expectations.
AP Business Writer Sandy Shore contributed to this report.