Microsoft Corp. (>> Microsoft Corporation) said Friday that long-time Chief Executive Steve Ballmer intends to retire within the next 12 months, a move that comes just over a month after he unveiled a shift in focus for the tech giant.

Mr. Ballmer, who is 57 years old and has been CEO since January 2000, will depart after a successor is chosen. The board has appointed a special committee that includes Chairman Bill Gates to find a new CEO and will consider both external and internal candidates.

"There is never a perfect time for this type of transition, but now is the right time," Mr. Ballmer said in a prepared statement.

Shares jumped 6.7% to $34.55 in recent trading, bringing their year-to-date increase to 29% and adding about $20 billion in market value.

Under Mr. Ballmer's leadership, Microsoft has endured years of investor criticism as the rise of mobile devices and Internet services eroded the influence of the personal computer-era kingpin. The company has responded to the pressures in a variety of ways already, including taking the radical move of developing and selling its own tablet-style computer in competition with longtime partners.

In his statement, Mr. Ballmer said his "original thoughts on timing would have had my retirement happen in the middle of our company's transformation," but said the company now needs a CEO who "will be here longer term for this new direction."

Mr. Ballmer--who has spearheaded multiple major restructurings during his tenure--has led several Microsoft divisions since joining the company in 1980, including operations, operating systems development, and sales and support. In July 1998, he was promoted to president, a role that gave him day-to-day responsibility for running the company.

The disclosure comes as the tech giant, although vastly profitable, has been stymied in its efforts to adapt to a range of new computing platforms and approaches. Mr. Ballmer last month announced a sweeping reorganization of the company, which is aimed partly at increasing its momentum in tablets and smartphones.

At the time, industry insiders had said the move elevated the profile of some established players in Microsoft's management ranks, while pointing to no single front-runner to eventually succeed Mr. Ballmer.

Colin W. Gillis, a BGC Partners analyst who covers Microsoft, said he expects more weakness in Microsoft's current quarter and suggested Mr. Ballmer's retirement would have been prompted by multiple inputs and possibly accelerated by weakness at the end of the company's recently ended fiscal year.

Last month, Microsoft reported that it took a $900 million charge on its high-profile Surface RT tablet, contributing to fourth-quarter results that sharply missed revenue and profit expectations.

"Ballmer will hand over what could possibly be a ball of spaghetti to the new guy," Mr. Gillis said, suggesting that potential internal successors could be any of the company's lieutenants, including Qi Lu, who runs the Bing Web-search engine; Satya Nadella, the leader of its back-end server software and database operations; or even Mr. Gates.

But others indicated an outside candidate would be a more likely choice.

Gartner analyst David Cearley said Microsoft will likely take one of two approaches in picking a new CEO: It could look for someone within the technology industry, he said, although not someone from "old-style" firms like Hewlett-Packard Co. (>> Hewlett-Packard Company), Oracle Corp. (>> Oracle Corporation) or International Business Machines Corp. (>> International Business Machines Corp.), but someone with a "clear understanding of the dynamics driving the new world."

Alternatively, he suggested Microsoft could choose a CEO with strong leadership capabilities and an understanding of technology from a software-oriented company like General Electric Co. (>> General Electric Company).

Janney analysts Yun Kim and Alice Hur also expect the new CEO to come from outside the company, noting many key senior executives have left the company or retired in recent years.

"We think the company is in need of a cultural change to increase collaboration between different product lines and foster faster innovations, which is the key focus of its recently announced reorganization," they said. "We think an outsider will have a far better chance of executing this plan than an insider."

Meanwhile, in a memo to Microsoft staff, Mr. Ballmer called the company an "amazing place," and noted it has grown to nearly $78 billion in annual sales from $7.5 million when he joined and from employing just over 30 people to almost 100,000.

"I take this step in the best interests of the company I love," he said. "It is the thing outside of my family and closest friends that matters to me most.

Write to Saabira Chaudhuri at saabira.chaudhuri@wsj.com