Indian shares ended higher for a fourth straight session on Wednesday, with gains across the board ahead of results from major IT firms, while upbeat cues from global markets also lifted sentiment.

The blue-chip NSE Nifty 50 index closed up 0.87% at 18,212.35 and the benchmark S&P BSE Sensex ended 0.88% higher at 61,150.04. Both indexes scaled a 11-week high during the session.

Shares of car maker Mahindra and Mahindra  added nearly 5% to be the top percentage gainer on the Nifty 50 index.

Telecom operators Bharti Airtel and Vodafone India  closed up 4% and 9%, respectively.

The Nifty energy index added 2.1%, led by a 4.5% rise in Adani Transmission Ltd .

Shares of heavyweight Reliance Industries Ltd rose for a fourth straight session, adding nearly 3%, and were among the top gainers on the benchmark indexes.

Federal Bankshares settled up 2.13%, after the lender approved a fundraise of up to 7 billion rupees.

The Nifty IT index .NIFTYIT ended muted as a nearly 1.2% gain in Infosys INFY.NS was offset by Tata Consultancy Servicesand Wipro  shedding 1.4% and 0.4%, respectively. The companies will be reporting third-quarter results later in the day.

One cannot rule out the possibility of a consolidation in markets and going forward, earnings numbers and the upcoming budget will determine further direction, said Ajit Mishra, vice president of research at Religare Broking.

MSCI world stocks ose, while the Nasdaq and S&P 500 .SPX recorded their best sessions of 2022 overnight after U.S. Federal Reserve Chair Jerome Powell sounded less bullish on rates than expected in testimony to Congress.

India's consumer price inflation data is due at 1200 GMT on Wednesday, with a Reuters poll of 41 economists showing retail inflation spiking to 5.80% last month from 4.91% in November.

(Reporting by Chandini Monnappa in Bengaluru; editing by Uttaresh.V and Ramakrishnan M.)