Stocks recorded their best day since March on Tuesday after strong corporate results and renewed hope for an agreement in Washington on thorny budget issues boosted investor confidence.

Quarterly numbers from technology bellwether International Business Machines Corp and Coca-Cola lifted technology and consumer shares in the first heavy week of second-quarter results. IBM gained 5.7 percent, leading the Dow's gainers.

The Nasdaq gained more than 2 percent, led by big-cap tech, including Apple , which hit a 52-week high during regular trading. After the market closed, the maker of iPhones and iPads reported revenue well above analysts' estimates, sending its shares up 6.7 percent to $402.

Nasdaq 100 index futures rose 22 points, indicating a higher open for stocks on Wednesday.

The market has been looking for leadership and it hasn't been getting it from finanicals... The fact that tech companies can deliver or exceed results gives markets hope that stocks can rise, even given broader macro concerns, said Nicholas Colas, chief market strategist at the ConvergEx Group.

In Tuesday's session, the S&P information technology sector <.GSPT> was the best performing sector, gaining 2.7 percent.

Markets gained momentum late in the day after President Barack Obama suggested progress was being made toward a $3.75 trillion deficit reduction deal centered around entitlement reform.

The White House and Congress also need to sign an agreement that includes an increase in the federal debt ceiling by August 2 or the United States could default on its debt.

Stocks are starting to bounce at least for the time being, with people wagering that there will be a resolution on the debt ceiling, said Wayne Kaufman, chief market analyst at John Thomas Financial in New York.

Among financial shares, Goldman Sachs Group Inc and Bank of America ended down following their earnings results. After advancing in the morning, Bank of America shares fell 1.5 percent to $9.57, while Goldman declined 0.6 percent to $128.49.

Wells Fargo shares jumped 5.7 percent, the biggest gain on the S&P financials index, after the bank said its profit rose 30 percent.

In terms of the overall earnings season, I'd say things have been pretty good so far, said Phil Orlando, chief equity strategist at Federated Investors.

The Dow Jones industrial average <.DJI> was up 202.11 points, or 1.63 percent, at 12,587.27. The Standard & Poor's 500 Index <.SPX> was up 21.27 points, or 1.63 percent, at 1,326.71. The Nasdaq Composite Index <.IXIC> was up 61.41 points, or 2.22 percent, at 2,826.52.

Goldman's second-quarter net income fell short of lowered expectations as fixed income trading revenue dropped sharply. Bank of America recorded a second-quarter net loss of $8.8 billion.

Coca-Cola Co posted slightly higher-than-expected profit. Shares rose 3.3 percent to $69.32.

Housing starts hit a six-month high in June. The PHLX Housing Index <.HGX> rose 3 percent.

Volume was light with about 7.01 billion shares traded on the New York Stock Exchange, NYSE Amex and Nasdaq, below the daily average of 7.49 billion.

About four stocks rose for every one that fell on the New York Stock Exchange and the Nasdaq.

(Reporting by Ashley Lau; Additional reporting by Daniel Bases; Editing by Kenneth Barry)