Stocks advanced broadly on Tuesday as optimism grew over an upcoming confidence vote by the Greek parliament, a key hurdle for the country to avoid a debt default.

Sales of existing U.S. homes fell 3.8 percent in May, less than some economists had feared, boosting investor appetite for equities for a second straight day.

Consensus grew that Prime Minister George Papandreou's cabinet would survive the vote, easing fears about the euro zone debt crisis that have weighed on the market for months and contributed to the S&P's 5 percent drop since the start of May.

While the issue isn't fully resolved, investors are seeing some light at the end of the tunnel in terms of a plan to move forward, said Todd Salamone, director of research for Schaeffer's Investment Research in Cincinnati, Ohio. He added there could be some short-covering ahead of the vote after the weeks of losses.

The vote in Greece's parliament was due around 5 p.m. EDT. Officials said the Greek government had until July 3 to approve new steps to get the next installment of 110 billion euros in aid from the European Union and International Monetary Fund.

Analysts cautioned there could be steep downside potential if the vote doesn't go as expected.

If we break through the 200-day moving average, we could see a selloff down to 1,200 on the S&P, Salamone said.

After nearing its 200-day moving average Monday, the S&P 500 rebounded solidly above the level. Analysts identified 1,360 as the next technical level on the upside.

The Dow Jones industrial average <.DJI> jumped 104.33 points, or 0.86 percent, at 12,184.71. The Standard & Poor's 500 Index <.SPX> was up 16.33 points, or 1.28 percent, at 1,294.69. The Nasdaq Composite Index <.IXIC> put on 49.47 points, or 1.88 percent, at 2,679.13.

Gains in the Nasdaq were aided by large-cap technology companies. U.S.-traded shares of Research In Motion Ltd rose 5.3 percent to $27.25 after falling about 7 percent on Monday. A second marketing executive defected to a competitor, highlighting the difficulties in keeping pace with rivals.

Apple Inc rose 2.5 percent to $323.27.

Best Buy Co Inc rose 3 percent to $32.50 after the electronics retailer raised its dividend and approved a stock repurchase plan.

On the downside, Walgreen Co fell 5.4 percent to $42.75 after it failed to renew a deal with pharmacy benefits manager Express Scripts Inc . Express Scripts shares rose 0.4 percent to $55.

The Federal Open Market Committee begins a two-day meeting, with an announcement expected Wednesday afternoon, followed by Federal Reserve Chairman Ben Bernanke's new conference.

The Fed is expected to cut its growth forecast for 2011, but Bernanke will likely continue to argue the slowdown is temporary.

About 83 percent of stocks traded on the New York Stock Exchange were in positive territory, with 76 percent on the Nasdaq higher.

(Editing by Jeffrey Benkoe)