Lately, the market hasn't been treating ExxonMobil (XOM 0.23%) with a lot of respect. The oil and gas supermajor has noticeably underperformed the broader equity markets in the last 24 months. To give investors a perspective, this is how Exxon's stock performed since July 2011:

XOM Chart

XOM data by YCharts.

Compare this with the stock's performance for the previous eight years -- from July 2003 till July 2011 -- and it looks like this:

XOM Chart

XOM data by YCharts.

To summarize, Exxon underperformed the broader markets dramatically in the last two years.

I also calculated the stock's effective annual yield over the various holding periods, along with a comparison to S&P 500. There are two sets of data: The price return is the effective annual yield calculated using the stock price appreciation only, while the total return is the corresponding effective annual yield with reinvested dividends. Here's how the figures compare:

  

July 2011-July 2013

(2 years)

July 2003-July 2011

(8 years)

July 2003-July 2013

(10 years)

ExxonMobil

Price Return

5.7%

11.5%

10.2%

Total Return

8.3%

14%

12.7%

S&P 500

Price Return

12.2%

3.9%

5.6%

Total Return

14.7%

6%

7.8%

Source: Morningstar; author's calculations.

What's the big reason behind these diminished returns? And more importantly, will this stock continue to underperform in the foreseeable future? With fewer than 10 days before Exxon reports its second-quarter results, Foolish investors should be concerned whether this stock is worth a place in their portfolios.

The crux of the problem
For a company whose market capitalization is north of $400 billion, the answer isn't so straightforward. However, the unmistakable signs of declining profitability are hard to ignore. A cursory look at the company's profit margins for the last five years does not reveal much. However, upon delving deeper, the cash flow statements reveal a trend that long-term investors need to be wary of: Over the last five years, net cash used for investing activities has doubled from about $15 billion a year to more than $30 billion a year.

Many might argue, especially those in management, that this isn't necessarily a bad thing. Larger investments should translate into higher production volumes in an era of increasing global demand as well as competition. Additionally, investment horizons in the oil and gas industry are pretty long -- in fact, a matter of decades.

While these arguments are fair, profitability ultimately boils down to margins per barrel of oil extracted and sold. And that's where it seems like a problem. The following chart depicts Exxon's 10-year growth in revenue and capital expenditure over the last 10 years.

XOM Revenue 10 Year Growth Chart

XOM Revenue 10 Year Growth data by YCharts.

The era of cheap oil is over
While ExxonMobil operates as an integrated oil and gas company, the upstream segment accounts for about 74% of earnings after tax. The company's profitability is, therefore, largely tied up with its exploration and production activities.

Crude oil and natural gas liquids production fell 3.5% in the first quarter year over year. On an annual basis, total liquids production fell 11% to 1.99 million barrels a day in 2012 from 2.2 million bpd in 2010. More importantly, production costs have soared. Average cost of producing crude oil and NGLs stood at $100.7 per barrel in 2012, a whopping 36% jump from 2010 cost levels.

Clearly, Exxon's legacy assets aren't able to keep up production levels. These gigantic assets bases need more coaxing in order to keep production volumes stable, resulting in higher expenditures. Moreover, with unconventional resources proving to be much more costly, producing crude oil cheaply is soon becoming a part of history.

While major investments are under way, margins should likely remain suppressed unless crude oil prices shoots through the ceiling. The latter isn't an impossibility with crude prices currently nearing $110 per barrel.

Also, a company like ExxonMobil cannot be written off in a hurry. Exxon's strength lies in its efficiency, deep cash reserves, and shrewd management. Many of its current projects are ambitious. The company is also betting big on natural gas. Exporting LNG to Asia could be a profitable move, at least for the next five years.  

Of course, rising crude oil prices continue to be Exxon's biggest driver to improve margins. But whether this stock is capable of outperforming the broader markets still remains a $400 billion question. Long-term investors should carefully watch this stock.