Royal Dutch Shell has avoided its first quarterly loss in recent history helped by its trading business.

But it announced nearly $17 billion in impairment charges reflecting its lowered short-term oil and gas price outlook. 

Shell had warned last month it was set to slash the value of its oil and gas assets by up to $22 billion after the coronavirus crisis hit energy demand and weakened the outlook. 

"Shell has delivered resilient cash flow in a remarkably challenging environment," CEO Ben van Beurden said in a statement. 

The Anglo-Dutch company, however, warned of the continued impact of the pandemic on oil and natural gas prices and sales in the third quarter. 

Shell has responded to the pandemic by cutting its dividend for the first time since World War Two and slashing planned spending by $5 billion to a maximum of $20 billion this year. 

Movement restrictions to limit the spread of the virus have knocked energy demand with benchmark Brent oil prices falling below $30 a barrel in the second quarter, down by more than half from a year earlier. 

Adjusted earnings in the second quarter, which exclude special items and are adjusted to cost of supply, fell to $600m from $3.5 billion a year ago, beating analysts forecasts of a $674m loss. 

The earnings "reflected very strong contributions from crude and oil products trading and optimisation as well as lower operating expenses," Shell said.

Refining and trading operations earnings jumped to $1.5 billion, nearly 30 times higher than a year earlier, even as refinery crude oil processing rates fell by a quarter. 

Shell, the world's largest retailer with over 40,000 petrol stations, also saw a 39% drop in fuel sales, it said.