The rose 1 percent to close at 2,452.51, with information technology leading 10 sectors higher. The Dow Jones industrial average rose 196.14 points to 21,899.89, with Boeing contributing the most to the gains. The Dow also posted its biggest one-day pop since April.

Stocks closed higher on Tuesday on renewed hopes of U.S. tax reform.

Cashin pointed to a Politico report from Tuesday which said the Trump administration and key lawmakers had found common ground on how to approach tax reform . The prospects of tax reform were one of the major catalysts for the market after Trump's win in November.

"I think they were looking for a rebound rally to begin with. Markets are extraordinarily thin. The buying is light. A little bit of buying has a disproportional affect," he said. Equal to story on progress on tax, "the repatriation rumors are just as strong."

Art Cashin, director of floor operations at UBS, said a big chunk of the gains Tuesday, "maybe half," are related to speculation that the White House and Republicans are making progress on tax legislation or on at least a repatriation plan that would involve infrastructure spending.

Traders work on the floor of the New York Stock Exchange on January 5, 2017, in New York City.

Equities have had a stellar year, but have lost some of their appeal this month. The S&P is up about 9 percent year to date, but has fallen 0.7 percent in August. Stocks closed well off session lows on Monday.

"I think a lot of this has to do with yesterday's close," said Robert Pavlik, chief market strategist at Boston Private, noting the S&P managed to end Monday well off its session lows. "I think that gave the market confidence that we were positioned to go higher."

But "in my heart of hearts, I think it's too soon to jump back into the market with both hands," Pavlik said.

Boeing's stock rose 1.7 percent after the company received a government contract for intercontinental ballistic missile system replacements.

The stock also followed other defense companies higher after President Donald Trump's speech on the Afghanistan war.

In a primetime address Monday, Trump said that a swift U.S. troops withdrawal from Afghanistan would create a "vacuum" that terrorists would "instantly fill."

"We cannot repeat the mistake in Afghanistan our leaders made in Iraq," Trump added.

Defense stocks rose broadly following Trump's remarks, with the iShares U.S. Aerospace and Defense ETF (ITA) rising 1.2 percent.

The Nasdaq composite outperformed, rising 1.4 percent to close at 6,297.48. The index also snapped a three-day losing streak, along with the Technology Select Sector SPDR exchange-traded fund (XLK).

The benchmark 10-year Treasury note yield rose more than 2 basis points to 2.2 percent, while the two-year yield advanced to trade at 1.329 percent.

Investors have been following the bond market as they prepare for a key meeting between central bank officials later in the week.

Federal Reserve officials are expected to be joined by European Central Bank President Mario Draghi and Haruhiko Kuroda, the Bank of Japan governor. Investors will be on the lookout for any commentary related to global monetary policy.

"Central bankers will begin gathering on Thursday night in one of the most highly anticipated Jackson Hole symposiums in recent memory," said Jeremy Klein, chief market strategist at FBN Securities, in a note to clients.

"However, most analysts do not expect [Fed Chair] Janet Yellen or Mario Draghi to break any new ground with monetary policy when speaking at the conference. Shares should therefore regain their footing as we close out August and head into September albeit neither the Fed nor the ECB has enough sugar in the cupboard to make the medicine each will soon administer go down easily," Klein said.

The Fed is expected to start rolling off its massive $4.5 trillion balance sheet next month, but investors are split on when the next rate hike will arrive. Market expectations for a December rate hike are 41 percent, according to the CME Group's FedWatch tool.