U.S. stocks rallied Thursday after they opened lower due to the European Central Bank raising interest rates to 0.75 percentage point in an effort to stifle inflation.

As of 10:51 a.m. ET, the Dow Jones Industrial Average rose 85.23 points, or 0.27%. The S&P 500 gained 12.21 points, or 0.30%, and the Nasdaq Composite climbed 37.97 points, or 0.28%. The early rise added to Wednesday's gains after three weeks of losses.

Some of the gainers included Snapchat maker Snap (SNAP), which rose $0.92, or 8.04% to $12.38. Chipmaker Advanced Micro Devices (AMD) gained $2.75, or 3.45%, to $82.35.

The gains came as the Federal Reserve ponders a similar increase as the ECB's latest move. Answering questions Thursday morning at the Cato Institute, Federal Reserve Chairman Jerome Powell reiterated that the central bank intends to do all it could to fight inflation.

The Fed is expected to raise interest rates for a fifth time later this month.

"Recession risk is rising and we have been moving more defensive in our portfolios as a result," Lauren Goodwin, economist and portfolio strategist at New York Life Investments, said in a note to clients. "However, high inflation means that traditional 'risk off' strategies such as cash and government bonds can create a drag on total return."