Strong sales of the PlayStation 4 and a solid performance at the box office led Sony to post quarterly results that have everyone surprised. The electronics and entertainment company reported revenue of $17.9 billion, up nearly six percent year-over-year, resulting in a profit of around $261 million. Most analysts were expecting a loss.

Sales of the company's next-generation console were up 96 percent in the quarter as it continues to outpace Microsoft's Xbox One. As a result, the games unit realized a profit of $43 million compared to a massive $164 million loss during the same period a year ago.

Sony Pictures, the company's film and television arm, had an impressive quarter as well thanks largely to releases like The Amazing Spider-Man 2 which has grossed more than $700 million worldwide and 22 Jump Street, a flick with ticket sales of nearly $280 million and counting.

The company's mobile division, however, didn't do nearly as well. The unit posted a loss of around $26 million as sales of its Xperia smartphones continue to decline. Sony said they expect to sell 43 million Xperia phones this year, down from a previous forecast of 50 million.

Despite the surprise quarterly profit, Sony is still expected to post a loss for the year which would be the sixth annual loss in the past seven years following declining sales of compact cameras and televisions.