As a shareholder of Joy Global (JOY) I, like many others, have been disappointed with the company's performance during the last few years.

Still, Joy's poor performance has not been entirely the company's or management's fault. Indeed, a global slowdown in mining activity as well as a slumping coal price have both weighed on Joy's sales, order book, and earnings.

However, it would appear as if the mining industry is staging a recovery, and Joy is set to benefit.

Market showing some signs of improvement 
When Joy reported its fiscal first quarter earnings at the end of January the numbers spoke for themselves. Year on year, sales slumped 27% and operating income collapsed by more than 60%.

Nevertheless, on the earnings conference call, Joy's management remained fairly upbeat. Actually, if anything, management was positive about the company's outlook as they reported some green shoots appearing within the oversupplied coal market.

...we've seen some of the supply balanced by continued demand coming from developing Asia. In China, we've now seen imports increase to 264 million tonnes through October or 18% above last year. Similarly, India's demand has remained strong, with thermal coal imports trending up over 40% through September ... During 2013, we saw the U.S. coal market remain under pressure, but we are now seeing some improvements. Coal consumption is expected to grow over 7% this year...Inventories have reduced from the production overhang in 2012, which should get a production response in 2014...we've seen some firming in prices of late [of metallurgical coal], as China's import demand has increased nearly 50% from a year ago.

For a machinery company that specializes in equipment for the production and mining of coal, an uptick, or firming of demand within the coal market is great news for Joy. A recovery in coal prices is likely to have the knock on effect of driving demand for the company's services.

Still, it cannot be said that the coal market is near a recovery as oversupply continues to plague the industry and cleaner, longer lasting fuels continue to replace the black mineral as a preferred power source around the world.

But while Joy waits to benefit from a recovering coal mining industry, the company's aftermarket services division is keeping the cash flowing in.

Aftermarket services remain strong
While Joy's sales collapsed during the first fiscal quarter, one area of the business that remained strong was the company's aftermarket services offering.

While total net sales declined 27% year on year during the first quarter and equipment bookings slid 16%, aftermarket service bookings ticked up by 4% although overall, total aftermarket service revenues declined by 3%, although this is nothing compared to the slump in equipment orders placed with Joy.

Surprisingly, most of Joy's new aftermarket service orders originated from the U.S., adding further support to the argument that the U.S. coal market is staging a recovery.

...The 3% year-over-year decrease in consolidated aftermarket bookings was attributable to a 1% decrease in underground and a 5% decrease in surface. Increased underground mining rebuild activity drove improvements in the Americas, but was more than offset by declines in Eurasia and China...

All in all, Joy reported service income of $610 million for the first fiscal quarter and management believe that a higher figure of $650 million per quarter will be reported throughout the rest of the year.

Now if you look back at the second -- or the third quarter and the fourth quarter of fiscal 2013, aftermarket bookings over this period averaged just over $650 million. We believe this is more representative of the average level of aftermarket bookings we will see across fiscal 2014...

So, these results and comments are highly encouraging as it would appear that the U.S. coal market has bottomed out, which should translate into higher demand for Joy's products and services over the next few quarters.

Nevertheless, as the coal market appears to be on the road to recovery, there is another problem that Joy is going to have to overcome: China.

The Chinese problem
Joy has a problem in China and it has nothing to do with the Chinese economy. No, Joy is having to compete with Chinese mining equipment producers, which have upped their game recently are now producing capital equipment that rivals Joy's offering.

For example, it used to be the case that mining companies such as Rio Tinto (RIO 2.25%) would stay away from Chinese heavy industrial equipment, despite the lower price as the kit was usually of an inferior quality.

But now the quality of Chinese equipment has improved, and is, according to some, on par with that manufactured by U.S. peers.

Indeed, according to comments from Rio's CEO Sam Walsh given in an interview with The Wall Street Journal:

The Chinese manufacturers are really improving in this field and can now be compared to the major US manufacturers... funnily enough [on the rail cars] the quality actually was much higher [compared to the miner's traditional supplier]...Instead of spot welds, for example, on the sheet metal they were actually continuous welds.

As a result, Walsh revealed that Rio had actually been increasing its purchases of heavy equipment from Chinese and Indian companies, stating that the savings were "significant." According to Financial Times, Mr. Walsh claimed that Rio has brought "thousands" of Chinese rail cars for the company's operations, along with ship loaders and trucks.

But Joy is not going to stand by and let its Chinese competitors steal market share. The company is concentrating on improving the quality of aftermarket services, "Being first, fast, flawless," and the company recognizes the Chinese threat: "there's no secret, there's multiple competitors in China. And so we're working very hard to differentiate with our technology and with our service model."

Foolish summary
Overall, Joy Global has had a tough past few years but it would appear that things are moving in the company's favor.

The coal market appears to be recovering and Joy's management and reputation are working to drive sales of aftermarket services, which are providing a level of riskless recurring income for the company. It would seem as if Joy is staging a comeback.