U.S. stocks fell sharply on Wednesday as oil prices surged after Iran's missile attack on American forces and as the Federal Reserve prepared to announce its rate decision.

The S&P 500 lost 1.1%, and the Nasdaq Composite declined roughly 1.4%. West Texas Intermediate crude futures climbed 6.9% to $89.88 a barrel.

President Donald Trump pledged that the US would strike Iran "hard" in retaliation. US Central Command announced that Islamic Revolutionary Guard Corps forces fired multiple ballistic missiles at American troops in the Middle East in a surprise attack. All incoming missiles were successfully shot down.

The US Federal Reserve is widely expected to hold its benchmark rate steady in its current target range of 3.5% to 3.75%. However, a rate hike remains possible, with traders putting the odds of a hike at roughly one in three. Fed Chair Kevin Warsh is scheduled to hold a press conference following the decision on Wednesday afternoon.

Semiconductor stocks continued to lose ground. The iShares Semiconductor ETF fell more than 4%, and the PHLX Semiconductor Index dropped about 4.6%. Chip stocks have shed 10% this week. Investors are growing uneasy about whether massive outlays on artificial intelligence will pay off and whether Chinese rivals pose a greater threat.

Micron Technology shares lost 5%, Advanced Micro Devices declined more than 5%, and KLA tumbled more than 8%. Among other movers, Procter & Gamble stock slid more than 3% after falling short of revenue estimates for the quarter. Ford Motor stock gained 5% after topping earnings expectations and lifting its outlook for the full year.

Investors are watching earnings from Meta and Microsoft, both due after the close of trading Wednesday.