Profits are a lagging indicator for a once-successful company. A large company with entrenched products can coast for a long time while in decline. For example, RIM basically sank in 2007-2008. They had opportunities to save themselves well after that, but that's when it started, and they passed up those opportunities. However, their decline didn't really show up in their financials until 2012.
Microsoft looks to me like they're the same way. Surface and the new Windows Phone are analogous to RIM's late, lame attempts to ship a large-touchscreen Blackberry. Microsoft is profitable for the same reason they've been profitable for the past couple of decades: Windows and Office. However, that's now a declining market. It's still huge, and they can milk it for a long time, but it's on the way out. It looks like they missed their chance to move on to something else in favor of hanging on to their cash cows as they sink.