The past six months have not been kind to FedEx (FDX -0.63%) shareholders, as the stock has fallen from a high around $185 to less than $143 as of Monday morning.

FDX Chart

FedEx Stock Performance, data by YCharts

However, FedEx stock now looks quite attractive, particularly compared to its top rival United Parcel Service (UPS 0.06%). For investors who are interested in FedEx stock, it may be a good time to start building a position, prior to the company's earnings report on Wednesday.

Restructuring delivers earnings growth
A little more than three years ago, FedEx unveiled a big cost-cutting program designed to boost operating profit by $1.7 billion annually. Most of the savings were to come from right-sizing the FedEx Express division and modernizing its aircraft fleet.

This cost-cutting program started to impact FedEx's results during fiscal 2014. Since the second half of that year, earnings-per-share growth has accelerated. In fiscal 2015, adjusted earnings per share increased 27% to $8.95 from $7.05 a year earlier. The company also expects EPS of $10.40-$10.90 in fiscal 2016. The midpoint of that range would represent a 19% year-over-year increase.

FedEx's restructuring program should drive one more year of strong earnings growth in fiscal 2017. Indeed, just getting the FedEx Express and FedEx Freight segments up to their minimum target margins of 10% would add about $1 billion in operating income relative to fiscal 2015.

Plenty of additional growth opportunities
Longer-term, FedEx has lots of room to grow. In the U.S., it has been gaining market share from UPS in the ground shipping business for more than a decade. FedEx has been investing heavily to support further growth in this high-margin business as e-commerce shipment volumes rise.

FedEx is expanding its ground shipping capacity at a rapid clip. Photo: The Motley Fool

FedEx's new facilities should enable more efficient sorting operations while increasing capacity. In future years, FedEx Ground won't need such massive investments to continue growing, meaning that it will start to generate very strong free cash flow.

Outside the U.S., FedEx's acquisition of Dutch rival TNT Express will significantly increase its market share within Europe compared to market leaders DHL and UPS. This proposed merger has cleared most regulatory hurdles and should close within the next few months. Combining the two delivery networks will unlock significant revenue and cost synergies.

Bargain valuation
Despite these ample earnings growth opportunities, FedEx stock is quite cheap, trading for about 13.4 times the midpoint of its fiscal 2016 EPS guidance range.

There are certainly clouds on the global economic horizon, which probably explains why FedEx shares have fallen so steeply in the past six months. Nevertheless, it is clear that global trade will rise in the long run. Thus, long-term investors should look past these blips in economic growth.

Furthermore, United Parcel Service -- a slower-growth company that is equally exposed to global GDP fluctuations -- trades for nearly 17 times analysts' 2016 earnings estimates. If FedEx continues to generate superior earnings growth, this valuation gap with UPS is bound to close over time.

FedEx could face some ups and downs in the next couple of years as it integrates TNT Express' operations and tries to slash costs there to improve profitability. However, investors who are willing to be patient for several years are likely to get very strong returns from FedEx stock.