FILE - In this Jan. 3, 2020, file photo visitors to the New York Stock Exchange pause to take photos in New York. The U.S. stock market opens at 9:30 a.m. EST on Wednesday, Jan. 8. (AP Photo/Mary Altaffer, File)
FILE - In this Jan. 3, 2020, file photo visitors to the New York Stock Exchange pause to take photos in New York. The U.S. stock market opens at 9:30 a.m. EST on Wednesday, Jan. 8. (AP Photo/Mary Altaffer, File) Credit: Mary Altaffer

U.S. stocks climbed toward records Wednesday on hopes that the United States and Iran were backing away from the edge of war.

The rally capped a whirlwind of reversals in markets around the world. Investments initially reeled early Wednesday after Iran fired missiles at two military bases in Iraq that house U.S. troops, retaliation for a U.S. drone strike that killed a top Iranian general last week.

Gold soared as dollars poured into safer investments, crude oil jumped on expectations that a possible war would damage supplies and the futures market suggested U.S. stocks were set to drop sharply as soon as trading opened in New York. But the selling abated as reports suggested no Americans died and after Iranโ€™s foreign minister said his country had concluded โ€œproportionate measures in self-defense.โ€

When trading opened, the S&P 500 pushed modestly higher, and it nearly tripled its gain after President Donald Trump confirmed that no Americans were hurt and that Iran โ€œappears to be standing down.โ€ Trump suggested adding economic sanctions on Iran, but he added that the U.S. is โ€œready to embrace peace with all who seek it.โ€ That fit with the marketโ€™s hopes that no further escalations may be on the way, at least for now.

Not only did stocks climb, crude oil slumped sharply and gold fell for the first time in 11 days. Treasury yields rose in a sign of optimism, and a measure of fear in the stock market eased lower.

The stock market has historically bounced back quickly from geopolitical shocks, such as Fridayโ€™s U.S. killing of Iranian Gen. Qassem Soleimani, as long as they donโ€™t result in a war and recession, said Linda Duessel, senior equity strategist at Federated Investors.