What happened

Shares of FedEx (FDX 0.33%) gained 20.1% in July, according to data provided by S&P Global Market Intelligence, with more than half of that gain coming on the first day of that month. The company delivered earnings that reassured investors FedEx was holding up well during the pandemic, and that gave a lift to the stock.

FDX Chart

FDX data by YCharts

So what

FedEx did well in July, but the biggest news item propelling the stock higher in the month actually came on July 31. After markets closed that night, the company reported fiscal fourth-quarter earnings of $2.53 per share on revenue of $17.4 billion, easily topping consensus analyst estimates for $1.52 per share on sales of $16.5 billion.

We went into earnings season knowing COVID-19 was going to impact transportation companies, but we weren't really sure whether the net effect would be positive or negative on the bottom line. The pandemic has slowed industrial production and changed shipping patterns, but it also has led to growth in e-commerce and with it, demand for home deliveries.

FedEx in its earnings report said that COVID impacted "virtually all revenue and expense line items," including about $125 million in extra operating costs for added personal protection equipment and cleaning.

A FedEx delivery truck on a city street.

Image source: FedEx.

But the company also reported gains in residential shipping, as well as pricing power on trans-Pacific shipments due to passenger airlines cutting flights and not having their cargo holds available.

The results led to at least a half dozen analyst price-target boosts in the days that followed, which helped propel the stock higher.

There wasn't a lot of company-specific news for the rest of the month to drive the stock higher, but it turned out FedEx was a trend setter when it came to earnings. A series of stronger-than-expected earnings reports by transport companies as the month went on, capped off by FedEx's archrival at the end of July, pushed the entire sector higher.

Now what

There is reason to hope that the strong quarter wasn't just a one-off. FedEx shareholders endured a miserable 2019 in part because the company was investing in its infrastructure in preparation for handling higher e-commerce volumes.

In the early days of the pandemic, there were concerns that the hoped-for stock surge in 2020 would not materialize, but FedEx today appears well-positioned to benefit from COVID-19 trends. There are still risks: FedEx did not provide any guidance due to continued uncertainty about the pandemic and its impact on the overall U.S. economy. But FedEx in July gave long-term investors a lot of reasons for optimism.