NEW YORK (CNNMoney) -- After nearly a full day in the red, stocks erased most of their losses in the last half hour of trading Wednesday.
The S&P 500 () ended higher by 2 points, or 0.2%. The tech-heavy Nasdaq ( ) added 11 points, or 0.4%.
Meanwhile, the Dow Jones industrial average () was basically flat, losing 6 points, or less than 0.1%. Not bad, considering the blue-chip index had fallen 190 points earlier in the trading day.
Worries about Greece leaving the eurozone fueled pessimism from the start of the trading day, as did disappointing earnings, sales and outlook from Dell.
"The Dell news sent some fears through the tech sector," said Timothy Ghriskey, chief investment officer at Solaris Asset Management. "The concern is that this goes beyond just Dell. We saw similar news out of Cisco recently."
Investors were also keeping close tabs on Facebook (sued Facebook and CEO Mark Zuckerberg Wednesday, along with lead underwriter Morgan Stanley ( , Fortune 500) and others, accusing them of withholding negative information ahead of company's initial public offering.) and the unfolding saga there. Three investors
Shares of Facebook, which lost 18% from its IPO price in the first two days of trading this week, rebounded about 3%. It was higher in earlier trading, pulling back when the investor lawsuit became public.
European leaders were meeting in an ad hoc summit to address the latest problems with sovereign debt. The meeting is occurring amid growing worries that Greece is moving closer to dropping the euro, and about what the contagion effects an exit might have on other economies.
Former Greek prime minister Lucas Papademos told Dow Jones Newswires late Tuesday that Greece is considering preparations to leave the eurozone.
"I think the biggest issue for U.S. markets remains the story in Europe," said Michael Sheldon, chief market strategist at RDM Financial Group. "Does Greece pull out of the eurozone and what kind of contagion does that cause?"
U.S. stocks ended flat Tuesday, turning lower during the final hour of trading on reports about Greece's preparations to leave the eurozone.
World markets: European stocks closed sharply lower. Britain's FTSE 100 ( ) lost 2.5%, while the DAX ( ) in Germany fell 2.3%. France's CAC 40 ( ) tumbled 2.6%.
The World Bank cut its growth estimates for growth in the Asia-Pacific region, including China. It now forecasts a growth of 7.6% this year -- down from 8.2% in 2011, and 10% as recently as 2010.
Asian markets ended lower following the World Bank's cut of growth forecasts. The Shanghai Composite () slipped 0.4%, while the Hang Seng ( ) in Hong Kong lost 1.3% and Japan's Nikkei ( ) tumbled nearly 2%.
Companies: After slumping during the day, Hewlett-Packard ( , Fortune 500) shares rose more than 5% in after hours trading after the company announced its earnings topped estimates. HP plans to reduce its workforce by 27,000 employees by October 2014.
Automaker Ford Motor (Fortune 500) had its debt upgraded out of junk bond status by Moody's late Tuesday -- an important benchmark for the automaker that will lower its borrowing costs, and allow it to reclaim collateral it put up for a credit line. Shares gained, as did those of rival General Motors ( , Fortune 500), which is awaiting its own upgrade to investment grade.,
Toll Brothers () shares rose 2.7% after the homebuilder reported better-than-expected earnings and revenue that was in line with forecasts. It also upped its guidance for the second quarter.
Shares of Hormel (Fortune 500) edged 1.1% higher after the meat processor reported a better-than-expected gain in earnings before the open.,
Economy: New-home sales rose more than expected in April to an annual pace of 343,000, up from 332,000 in March. The report follows a strong report on sales of existing homes Tuesday, in which sales climbed 10%.
Currencies and commodities: The dollar rose to its highest level in nearly two years against the euro. The greenback also edged higher versus the British pound, but lost ground against the Japanese yen.
Oil for July delivery slipped $1.95, or 2.1%, to $89.90 a barrel, the first time since November that it has fallen below the $90 benchmark. Officials from six world powers are due to hold talks with Iran in Baghdad on Wednesday about its nuclear program, raising hopes that there might be an deal that would end sanctions against Iran.
Gold futures for June delivery tumbled $28.20, or 1.8%, to $1,548.40 an ounce.
Bonds: The price on the benchmark 10-year U.S. Treasury moved slightly higher, knocking the yield down to 1.74% from 1.79% Tuesday.
|What we want Apple to unveil at WWDC|
|Millennials squeezed out of buying a home|
|7 traits the rich have in common|
|Big Data knows you're sick, tired and depressed|
|Your car is a giant computer - and it can be hacked|
|Overnight Avg Rate||Latest||Change||Last Week|
|30 yr fixed||3.85%||3.93%|
|15 yr fixed||2.98%||2.99%|
|30 yr refi||3.93%||3.98%|
|15 yr refi||3.05%||3.05%|
Today's featured rates: