Exxon Mobil (XOM  ) shares finished 4.6% higher following its better-than-expected Q2 earnings even though the company missed expectations on the top line. However, shares declined over the next week by more than 10% as the stock fell along with crude oil prices.

It was also a notable quarter for Exxon in that it was its most profitable ever. In the first half of the year, Exxon has generated just over $27 billion in free cash flow. The stock formed a double bottom in the spring of 2020 and October 2020 which coincided with the front-month contract in oil falling to negative prices due to plunging demand during COVID lockdowns and Exxon getting kicked out of the Dow Jones Industrial Average (DIA  ) in favor of Salesforce (CRM  ).

Inside the Numbers

In Q2, Exxon Mobil reported $4.14 per share which easily exceeded analysts' estimates of $3.74 per share. This was a 280% increase from last year and a total net income of $17.85 billion exceeded its previous record of $15.9 billion by 12%. Revenue missed forecasts at $115.7 billion vs $132.7 billion but was up 71% compared to last year.

In the press release accompanying the earnings release, management attributed the beat to Increased production, near-record high oil prices and margins, and aggressive cost controls. Equally impressive is $16.2 billion in free cash flow due to $20 billion in operating income and $3.8 billion in capital spending.

Exxon like other oil majors has benefitted from soaring energy prices, especially gasoline. Of course, the stock market is forward-looking which means that shares have sold off more than 10% due to weakness in gas and oil prices which are now below $90 per barrel.

So far, this drop seems more due to increasing fears of a recession, and these odds increased following Friday's jobs report as this was seen by many as evidence that the Federal Reserve needs to tighten more and for longer to stamp out inflation which is inconsistent with a booming labor market and high levels of wage growth.

Exxon continues to be attractive from a fundamental perspective with a forward P/E of 9 and a 4% dividend yield. Shares are up 45% YTD although off by 18% from their recent high.