The energy sector has been by far the top-performing sector in what has generally been a dismal year for stocks. As of Aug. 29, the sector was up 74% over the prior 12 months, and was one of only three sectors with a positive 12-month return -- the other two being utilities, up 10.8%, and consumer staples, up 3.8%.

While energy is a cyclical industry, some exposure to the sector through an exchange-traded fund (ETF) may help investors offset their losses in other investments. In particular, the fast-growing clean energy segment of the market may be a good place to invest, given the gradually shifting energy mix. Two of the best ETFs in this area are the iShares Global Clean Energy ETF (ICLN -0.60%) and the First Trust Nasdaq Clean Edge Green Energy Index ETF (QCLN -1.60%). Which is the better buy?

iShares Global Clean Energy ETF

The iShares Global Clean Energy ETF tracks the S&P Global Clean Energy Index, which includes clean energy-related companies from both developed and emerging markets. This means their businesses focus on solar, wind, and other renewable energy sources. Further, the ETF screens out companies with any significant connection to controversial weapons, small arms, military contracting, tobacco, thermal coal, oil sands, shale energy, and arctic oil and gas exploration -- with the screens based on revenue or percentage of revenue thresholds.

The resulting fund holds roughly 100 stocks, about half of them large caps, 37% mid caps, and the remaining 13% small or micro caps. About 45% are based in the U.S., 16% are based in China, and 9% are based in Denmark, to name the three nations with the most representation. The ETF's three largest holdings are Enphase Energy (ENPH -1.21%), Solaredge Technologies (SEDG -5.35%), and Denmark-based Vestas Wind Systems.

As of July 31, it has a one-year return of negative 0.5%, a five-year annualized return of 21.7%, and a 10-year annualized return of 15.9%. Year to date as of Aug. 30, it had returned 5% and was trading at around $22 per share. Further, it has an expense ratio of 0.42%.

First Trust Nasdaq Clean Edge Green Energy Index ETF

The First Trust Nasdaq Clean Edge Green Energy Index ETF tracks the Nasdaq Clean Edge Green Energy Index. This index consists of companies that are engaged in the manufacture, development, distribution, and installation of clean-energy technologies including solar photovoltaics, wind power, advanced batteries, fuel cells, and electric vehicles.

This ETF captures a slightly different segment of the market, as it includes electric vehicle companies like Tesla (TSLA -4.95%), for example, and more clean-energy-technology-oriented businesses. However, it has fewer holdings than the iShares fund -- roughly 65 -- as it only includes companies that are publicly traded in the U.S. But its breakdown by market cap is roughly the same, with 50% in large caps, 38% in mid caps, and 12% in small  and micro caps. Its three largest holdings are Enphase Energy, ON Semiconductor (ON -1.51%), and Tesla.

As of July 31, it had a one-year return of negative 6.8%, a five-year annualized return of 27.6%, and a 10-year annualized return of 22.6%. Year to date as of Aug. 30, it was down about 6%, trading at about $63 per share. It has an expense ratio of 0.58%.

Which is the better buy?

These are two excellent ETFs in the clean energy space, and your preference may vary based on your needs. If you prefer your investments slightly less volatile, with lower standard deviations and betas, and greater diversification, then the iShares ETF may be the better choice for you. It has outperformed in the short term during the current market cycle, so it would provide some balance to a portfolio when most other investments are down. It also has more business-involvement screens to filter out companies that participate in activities that some people would rather not support. So if you prefer not to invest in businesses that profit from certain activities, you may prefer this fund.

The First Trust ETF is more growth oriented, and has had better long-term performance -- its 22.6% average annual return over the past 10 years is a testament to that. However, its performance has been poorer in the current market environment, which has punished growth stocks as a class. Yet it has still beaten the S&P 500 over the one-, five- and 10-year periods. Finally, keep in mind that these are both sector funds. So while they can play an important role among your holdings, they should only represent a portion of a diversified portfolio.