The S&P closed 0.7 percent higher at 2,152.14 points and the Dow ended at 18,347.67 on Tuesday, as fears over Brexit abated and Japan signaled more stimulus measures.
Tuesday's US close
Japan's Nikkei 225 posted gains once again on Wednesday on the back of the weaker yen and expectations of a double-whammy of fiscal and monetary stimulus in the country.
U.K. and European stocks traded largely higher on Wednesday ahead of the installment of Theresa May as U.K. prime minister in the evening. She will replace David Cameron, who resigned after the U.K.'s referendum on European Union membership vote last month.
"Investors have erased global Brexit losses and want to lock some profit after a massive rally," Naeem Aslam, chief market analyst at Think Markets UK, said in a note on Wednesday.
"Generally speaking they are poised to take to take risk, however, caution remains the main theme among traders over in Europe. There have been some impressive gains over in Asia and U.S.; therefore you could say risk mode is gathering steam."
European stocks on Wednesday
The Federal Reserve's Beige Book will be out on Wednesday. Meanwhile, import prices rose 0.2 percent in June, below the 0.5 percent expected increase.
The International Energy Agency warned on Wednesday of signs global oil demand was flagging, while supply remained at "elevated levels."