Ginni Rometty, the longtime face of IBM and one of the country’s most prominent female business leaders, is stepping down as chief executive, the company said on Thursday.

Ms. Rometty, who became chief executive in 2012, struggled to achieve growth at the technology giant as it made the transition to new fields like cloud computing and artificial intelligence.

She will be replaced in April by Arvind Krishna, who now runs the company’s cloud computing business.

The timing of the departure of Ms. Rometty, 62, came as a surprise, made after the close of the market on Thursday in a lengthy statement filled with praise from IBM’s board. She will remain as executive chairwoman of the board until the end of the year.