Big oil companies returned to profitability during the first quarter as they recovered from the unprecedented destruction of oil-and-gas demand wrought by the coronavirus pandemicExxon Mobil Corp. reported $2.7 billion in net income Friday, its first quarterly profit since the pandemic erupted last spring, while Chevron Corp. reported $1.4 billion in first-quarter profit. The results were boosted by rising oil prices during the first months of 2021, as countries around the world soften coronavirus quarantines.

The largest European oil companies, BP PLC, Royal Dutch Shell PLC and Total SE, all reported profits earlier in the week after enduring huge losses last year. “That recovery, which we had anticipated happening at some point in time, is happening sooner than we anticipated,” Exxon Chief Executive Darren Woods said in an interview Friday. “As economies are reopening and rebounding quicker, in some places, than expected, we are seeing a demand response.”

Oil companies endured one of their worst years on record in 2020, as Covid-19 lockdowns choked off demand for oil and gas as road and air traffic fell precipitously. Exxon reported its first annual loss in modern history in 2020 of about $22 billion. But cautious optimism has been mounting that global economic activity could return to pre-pandemic levels later this year as vaccines become more widely available around the world.

Chevron Chief Financial Officer Pierre Breber said that demand for gasoline and diesel was nearly back to pre-pandemic levels, and that jet fuel is the last remaining overhang, with strong signs that domestic air travel in the U.S. is picking up.

“As we look forward, the next couple of quarters look very good,” Mr. Breber said in an interview. “We feel good about our ability to generate cash.”

Chevron’s net income was down about 62% from the same quarter last year, but was a substantial increase from a $665 million loss in the previous quarter. Exxon’s $2.7 billion profit compared with a $610 million loss a year ago. BP’s profit more than tripled from the previous quarter to nearly $4.7 billion, and Shell reported a profit of almost $5.7 billion.