Microsoft said on Thursday that Chief Financial Officer Peter Klein was leaving the company, as it struggles with sharply declining personal computer sales and a lukewarm reception for its new Windows 8 operating system.

Klein, an 11-year Microsoft veteran with 3 1/2 years as CFO, is the latest in a line of top-level executives to leave the company, following Windows head Steven Sinofsky last November. Some have questioned whether Chief Executive Steve Ballmer is still the right leader for Microsoft, whose shares have remained essentially flat for the last decade.

In announcing Klein's departure to employees, Ballmer praised Klein's part in the acquisitions of Skype and the social network Yammer, and said Klein "has had a profound impact on the finance profession overall, and exhibited good oversight on cost controls as CFO."

In his resignation letter, Klein wrote: "I am proud of the work that finance has done and the impact we have had on the Company. One reason that now is a good time to leave is that the organization is very strong, and I am delighted we will be naming an internal candidate. I couldn't be more optimistic about both the Company's and Finance's future."

Shares of world's largest software company clicked up after the closing bell, following the news.

What is Microsoft's stock doing now? (Click here for the latest after-hours quote.)

The software giant also reported fiscal third-quarter earnings that exceeded analyst expectations.

Earnings rose to $6 billion, or 72 cents per share, from $5.1 billion, or 60 cents per share, in the year-ago quarter.

Revenue improved 18 percent to $20.49 billion from $17.41 billion a year ago.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Analysts had expected the company to report earnings of 68 cents a share on $20.5 billion in revenue, according to a consensus estimate from Thomson Reuters.

Microsoft's profit was boosted by some deferred revenue from its Windows, Office and videogame operations, but cut severely by a big fine by European antitrust regulators for breaking promises relating to expanding the choice of Internet browsers on Windows.

Analysts have been pulling back profit forecasts for Microsoft in the light of flagging PC sales as consumers flock to tablets and smartphones.

In his letter, Ballmer wrote: "Our long term bets on the cloud are paying off, and while the mobile device environment is challenging, the decisions we made with Windows 8 and Windows Phone 8 set us up well for long term growth."

CFO Peter Klein's resignation letter:

One noteworthy characteristic of Finance is the regularity of its rhythm – month end, quarter end, year end. Every one of those milestones marks the passage of time. And as time passes, and milestones are marked, we all periodically reflect on our lives, our goals, and our priorities. As we approach the end of the fiscal year, I have been reflecting in that way. And I have decided that now is a good time for me to step away from Microsoft and take some time to spend with my family in a way that I haven't had the opportunity to do in the 30 years I have been working.

This has not been an easy decision. I love Microsoft. I love my job. When I joined Microsoft 11 years ago I had this loosely held belief that people were one of the most important elements of any job or any company. I had no idea how profoundly true that is, but I do now. People are everything. Microsoft is the most amazing collection of talented, passionate and caring people I could ever imagine being associated with. It's been an honor and my good fortune to have been part of that.

I am proud of the work that Finance has done and the impact we have had on the Company. One reason that now is a good time to leave is that the organization is very strong, and I am delighted we will be naming an internal candidate. I couldn't be more optimistic about both the Company's and Finance's future.

Looking ahead, I have no specific plans. In the short term I will work to ensure a smooth transition. After that I intend to spend time with my extended family which is dispersed throughout the country and hopefully get to some long deferred travel. For the last 11 years Microsoft has been my family and now I am going to focus on my other family.

Thanks for being such a great team – I will follow your success with great interest and pride.

Peter

CEO Steve Ballmer's announcement to employees:

Today in our earnings release, we announced that after nearly four years as CFO and 11 years at Microsoft, Peter Klein has decided to step down as CFO and leave Microsoft at the end of our current fiscal year. I will be naming a new CFO from our finance leadership team in the next several weeks.

Peter has been a key part of my leadership team and a strong advisor to me during his tenure. He helped drive the successful Skype and Yammer acquisitions, has had a profound impact on the finance profession overall, and exhibited good oversight on cost controls as CFO. I have really enjoyed working with Peter, and appreciate his many contributions to the finance organization, to Microsoft and to me.

I'm sure all of you have seen media coverage from the last two weeks. As I said in our earnings release, our long term bets on the cloud are paying off, and while the mobile device environment is challenging, the decisions we made with Windows 8 and Windows Phone 8 set us up well for long term growth. Highlights of our earnings are below. I encourage you to listen to our earnings webcast at 2:30 p.m. Pacific Time today at http://microsoft.com/investor.

Steve