The Dow Jones Industrial Average gained 202.26 points (1.63 per cent) to close at 12,587.42.
The broader S&P 500 jumped 21.29 points (1.63 per cent) to 1,326.73, while the tech-heavy Nasdaq Composite rallied 61.41 points (2.22 per cent) to 2,826.52.
IBM shares climbed 5.7 per cent after the tech giant reported that its net income rose eight per cent to $3.7 billion in the second quarter, helping to boost the Dow index of 30 blue-chip stocks.
Soft drinks giant Coca-Cola gained 3.3 per cent after it reported that profits rose 18 per cent in the second quarter, better than expected, on solid volume growth worldwide.
President Barack Obama added further fuel to the rally when he endorsed a plan put forward by a bipartisan group of senators aimed at ending the standoff over the federal government's debt limit.
The tense standoff between Democrats and Republicans has threatened to cause a potentially catastrophic government default by August 2, spooking investors and weighing on the markets in recent days.
"The latest surge that we had in the afternoon was due to the fact that President Obama is endorsing the deal proposed by the group of six senators," said Peter Cardillo, chief market economist at Avalon Partners.
"It's obvious that we are getting close to some agreement and that the debt ceiling will be raised, and the market is relieved of that."
Financial stocks were mixed on Tuesday as three major banks reported their earnings, revealing a wide range of results.
Wells Fargo, the United States' second-largest retail bank in terms of deposits, rallied 5.7 per cent after it reported that its net income grew 30 per cent in the second quarter to $3.73 billion.
Its number-one rival, Bank of America, slumped 1.5 per cent after reporting a $9.1 billion loss, mostly caused by a huge settlement intended to compensate investors for losses on mortgage-backed securities.
Shares of Goldman Sachs were down 0.7 per cent after the investment bank's second-quarter earnings fell short of expectations and it announced that was laying off 1,000 employees.
Johnson & Johnson fell 0.6 per cent after the pharmaceutical and health care giant reported that its quarterly profits dived 19.5 per cent from a year ago.
Bond prices rose. The yield on the 10-year Treasury dropped to 2.89 per cent from 2.91 per cent late Monday, while the 30-year bond fell to 4.20 per cent from 4.29 per cent.
Bond prices and yields move in opposite directions.
What the stars mean:
★ Poor ★ ★ Promising ★★★ Good ★★★★ Very good ★★★★★ Exceptional