To say that Exxon Mobil and Chevron faced a difficult 2020 would be a deep understatement. Their next challenge seems less daunting but could be trickier: Finding out what investors want.

Numbers tell the brutal year that was 2020. For the full year, the two giants’ total revenues declined by roughly 30% and their long-term debt burdens grew by roughly $20 billion each to levels not seen in the last two decades. No wonder the oil giants discussed a once-unthinkable merger last year.

By comparison, their first-quarter results look rather rosy. Exxon’s revenue and net income were higher than estimates from analysts polled by Visible Alpha; Chevron’s missed the mark largely due to weak downstream earnings. Both swung to net income after a year of being in the red and posted strong free cash flow: $3.4 billion at Chevron and roughly $6 billion at Exxon. That is quite the turn after a year of anemic free cash flow for Chevron and an outflow at Exxon. Despite the balance-sheet strain, both stuck to their promise of increasing dividends last year. Chevron already announced an increase this year.

Though higher oil prices are supporting the energy giants’ recovery, the pandemic’s effects linger. Downstream earnings were weak, partly because jet-fuel demand hasn’t fully recovered along with global travel.

Chemicals were the star performer at Exxon as strong plastics demand continued. The Texas winter storm was a mixed bag: At its peak, it knocked out roughly 75% of U.S. polyethylene capacity, including some Exxon plants, but that also had the effect of improving industrywide margins. Exxon’s first-quarter chemicals earnings were almost 10 times what they were a year earlier.

Despite improvements, both Exxon and Chevron shares fell slightly after Friday’s announcements, though their shares are up 25% and 13%, respectively, from 12 months earlier. Now that both companies are out of the danger zone, it is clear that investors will be demanding more from them.

For Exxon, that is materializing in the proxy fight that will occur next month, which seems to be gaining some traction. Activist investor Engine No.1 announced backing from large pension funds including Calstrs. Chevron, meanwhile, walks a careful tightrope on balancing its financial position and expectations for buybacks, for which investors are increasingly clamoring.

Investors have good reason to be assertive: Both companies’ returns on invested capital have been stuck in the single digits over the last five years— a far cry from their historical rate.

They have escaped the danger zone, but the coming quarters will present another set of management headaches.

Write to Jinjoo Lee at jinjoo.lee@wsj.com