Microsoft reported solid sales and earnings growth Thursday afternoon, handily beating expectations and giving a boost to the company's shares.

The software giant posted solid shipments of the Xbox One, selling 3.9 million of the new game consoles. Microsoft has been neck-and-neck with rival Sony (SNE), which launched the PlayStation 4 console a week before the Xbox One went on sale.

Microsoft also doubled sales of its Surface tablet, bringing in nearly $900 million in revenue from the device. That's a positive turnaround for a device that got off to such a slow start last year that the company was forced to write down nearly $1 billion in inventory.

But PC sales continued to haunt Microsoft: Consumer sales of Windows 7 and Windows 8 fell 20% last quarter, the company said. The company said overall Windows revenue fell just 3% in the quarter, as a 12% increase in businesses licensing the software offset the awful consumer sales.

Overall, Microsoft said in a statement that its fiscal second quarter sales topped $24.5 billion -- a 14% jump from the same time last year. Profit rose 3% to $6.6 billion and 78 cents per share.

Wall Street analysts were expecting revenue of $23.7 billion and earnings per share of 68 cents, according to a survey conducted by Thomson Reuters.

Microsoft (MSFT) shares rose 4% in after hours trading.

"It's a good quarter to ride out on," said BGC Partners analyst Colin Gillis, referring to the impending departure of Microsoft CEO Steve Ballmer.

Related: Microsoft CEO should be...

It was a good quarter for Microsoft, but the real question, he said, is who is going to succeed Ballmer.

"What direction are they going to take the company," he said. "They need to get it done."

Microsoft is expected to announce a successor sometime in the next month or two.

Microsoft's stock, like the broader market, enjoyed a healthy 2013 -- rising 38%. But Microsoft hasn't carried that success into 2014.

Weighing on the stock is uncertainty surrounding who will succeed Ballmer, declining PC sales and the rise of PC alternatives such as smart phones and tablets -- a segment the company has not been able to dominate.