FedEx (FDX  ) shares were 5% higher following the company's fiscal second-quarter earnings which showed the company beating analysts' expectations on the top and bottom-line. So far this year, Fedex's stock has been an underperformer with a YTD loss of 4%.

The company is dealing with a couple of challenges such as the labor shortage and higher fuel costs which have been impacting margins. It's also seeing some residue of the surge in e-commerce spending last year as this trend has moderated as well. A longer-term threat to the company is the growth in Amazon's (AMZN  ) logistics, fulfillment, and delivery services which many expect could overtake FedEx in the next couple of years.

Inside the Numbers

In its fiscal second quarter, FedEx posted earnings per share of $4.83 per share which was well above expectations of $4.28 per share. The company managed to post earnings that were flat compared to last year, while analysts were looking for an 11% decline.

Revenue came in at $23.5 billion, a 14% increase from last year. This also topped analysts' expectations of $22.4 billion in revenue. The company also said that costs were higher by $470 million in the quarter primarily due to labor market issues.

However, the company did say that labor market pressures are "starting to fade" leaving an environment with strong demand and pricing power.

This is reflected in its outlook for fiscal 2022 adjusted EPS of $20.50 to $21.50. This is a slight increase from its guidance last quarter of $19.75 to $21 per share which was one contributing factor in the stock's recent weakness. It also topped analysts' expectations of $19.74 in EPS.

Another indication of management's optimism and confidence in the stock is a new $5 billion share buyback equating to about 8% of the total market cap.

Overall, Fedex's results are certainly a positive and should stop its negative momentum. The company is quite attractive from a valuation basis with a forward P/E of 11 and a 1.2% dividend yield. Further, it seems to be back in growth mode especially with margins set to improve and double-digit revenue growth.