The main Spanish stock market index closed Wednesday with a slight decline, after the Federal Reserve chairman reinforced his commitment to reducing inflation, on a day when consumer prices in the United Kingdom rose against all odds.

In a speech prepared for his appearance before the U.S. Congress, Fed Chairman Jerome Powell said Wednesday that there is still a "long way to go" in its fight against inflation, raising fears that the current cycle of monetary tightening that threatens to trigger a recession is still far from over.

"We probably won't see 2% inflation in four years unless the Fed gets too aggressive and does like Volcker, and that's not in the cards," said Peter Cardillo, chief market economist at Spartan Capital Securities, referring to the Fed's current inflation target and Paul A. Volcker, a former central bank chairman famous for his anti-inflation campaign of the 1980s.

Still, money markets continue to expect only a 25 basis point rate hike in July and no more for the rest of the year, according to CMEGroup's Fedwatch tool.

On the other side of the Atlantic, where all signs point to further rate hikes by the European Central Bank, it emerged on Wednesday that UK inflation rose again by 8.7% month-on-month in May, when economists had expected a slight decline. The data comes a day before the Bank of England's monetary policy meeting, which is expected to raise rates to their highest level in 15 years.

As a result, the Spanish Ibex-35 closed down 3.40 points on Wednesday, or 0.04%, to 9,436.40 points, while the FTSE Eurofirst 300 index of large European stocks lost 0.43%.

The banking sector, which with the prospect of higher margins driven by further rate hikes kept the index up at times, closed with gains across the board: Santander rose 0.34%, BBVA gained 0.45%, Caixabank advanced 2.16%, Sabadell gained 1.62%, Bankinter gained 0.81% and Unicaja Banco rose 0.43%.

Among the large non-financial stocks, Telefónica fell 0.27%, Inditex advanced 0.73%, Iberdrola dropped 1.00%, Cellnex fell 1.44%, and the oil company Repsol rose 0.79%.

(Information by Darío Fernández; additional information by Shubham Batra and Johann M. Cherian).