Last year was a year the mining sector would rather forget. Plunging commodity prices panicked investors who fled the industry and turned their backs on commodity companies. This, in turn, had the knock-on effect of investors questioning the entire sector’s viability. Mining companies were shut out from the debt markets, and analysts began to claim that some of the world’s largest miners could collapse into bankruptcy if the situation failed to improve.

One year on and a lot has changed for the mining industry. Commodity prices have stabilised, the outlook for the world economy has improved, and investors are no longer scared of the sector.

The performance of Rio Tinto (LSE: RIO) and Glencore (LSE: GLEN) shares reflect how investor sentiment towards miners has changed over the past year. Year-to-date shares in Glencore and Rio are up 117% and 26% respectively, excluding dividends. And even after these gains, I believe Rio and Glencore once again look like attractive investments.

Not for the fainthearted

Shares in Rio and Glencore may have clocked up a relatively impressive year-to-date performance but investing in these miners isn’t for the fainthearted. After recent gains both trade at relatively rich valuations and remain exposed to commodity price movements. Any slowdown in global growth will hit commodity prices, which will delay their recovery process.

Still, for the long-term investor with an optimistic outlook for the global economy they’re attractive investments.

Based on current City figures, Rio’s earnings per share are expected to fall 27% this year, the third consecutive year of earnings contraction. However, for the year ending 31 December 2017 earnings are projected to remain unchanged, marking an end to the company’s run of poor performance. Meanwhile, Glencore’s earnings per share are expected to remain unchanged this year before rebounding by 57% next year.

Of course, these figures are dependent on commodity prices. But as Rio and Glencore continue to cut costs to improve margins it should become easier for these two mining champions to meet City expectations for growth.

Worth paying for?

Some investors may be put off the shares by the companies’ lofty valuations. Based on current City figures shares in Glencore are currently trading at a forward P/E of 41.5 and Rio’s shares are trading at a forward PE of 17.4.

If you factor-in Glencore’s projected growth, the company’s valuation doesn’t look too taxing. Next year, forecasts suggest that its valuation will fall to 28.2 times earnings and an earnings growth rate of 57% indicates that the shares are trading at a PEG ratio of 0.5 – a PEG ratio of less than one implies that the shares offer growth at a reasonable price.

Rio isn’t expected to chalk up any earnings growth next year, but the world’s largest iron ore miner deserves a premium valuation. Compared to its peer BHP Billiton, it looks cheap as BHP’s shares are currently trading at a forward P/E of 30.7 for the year ending 30 June 2017.

Overall, in my opinion, both Rio and Glencore look to be attractive long-term investments that will benefit from global economic growth.

The worst mistake you could make

According to a study conducted by financial research firm DALBAR, the average investor realised an average annual return of only 3.7% a year over the past three decades, underperforming the wider market by around 5.3% annually.

This underperformance can be traced back to several key mistakes that all investors make. To help you realise and understand the most common mis-steps, the Motley Fool has put together this new free report entitled The Worst Mistakes Investors Make.

The report is a collection of Foolish wisdom, which should help you avoid needlessly losing too many more profits. Click here to download your copy today.

Rupert Hargreaves has no position in any shares mentioned. The Motley Fool UK has recommended Rio Tinto. We Fools don't all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors.