Apple (AAPL 0.59%) has been steadily climbing the ranks of the Fortune 500 each year, as its revenue soars alongside popularity of the iPhone and iPad. Seven years ago, before the iPhone was released, the Mac maker ranked as No. 159. In 2013, the company scored No. 6, as its revenue has increased over eleven times since 2006.

Fortune has now released its Global 500 rankings for 2013, using the same methodology of ranking companies by revenue for their fiscal years. Under this broader lens, Apple ranks as No. 19 with its fiscal 2012 sales of $156.5 billion. Archrival Samsung sits higher on the list at No. 14 with its $178.6 billion in revenue last fiscal year. Most of the companies within the top 20 spots are oil companies or automakers. Apple and Samsung are the only tech names in the top 20. Apple supplier Hon Hai Precision, known more commonly as Foxconn, is the No. 30 company with $132.1 million in revenue.

However, if you sort the list by profitability, investors get an entirely different picture. Apple's $41.7 billion in net income last year earns it the No. 2 title in the world when it comes to profits. The only company ahead of it is ExxonMobil, the same company that Apple trades the market cap crown with from time to time.

Except that Exxon has to generate nearly three times Apple's revenue to earn its $44.9 billion in net income, which ranks it as the No. 3 largest company in the world by revenue. That means that Apple is easily the most profitable tech company in the world, and second most profitable company of any sector in the world. Ranking by profits, Samsung is the No. 12 company with $20.6 billion in net income.

Comparing net income also helps Microsoft's standing. On a revenue basis, the software giant is just No. 110; on a profit basis, Microsoft's rank jumps to No. 17. With $17 billion in net income, Microsoft lags its longtime rival significantly.