Solar stocks took a beating in the second half of 2015 and throughout 2016, but the sector turned around in 2017. In fact, one exchange-traded fund (ETF) tracking the sector – the Guggenheim Solar ETF (TAN) – generated impressive returns of over 54% last year. Solar stocks soared in the past due in part to federal tax credits for home solar installation and other incentives to stimulate the industry, but they were surprisingly resilient in 2017 despite a presidential administration that does not prioritize renewable energy to the same extent as its predecessor.

The facts on the ground suggest that solar's fortunes may remain strong over the medium and long term. Consider that solar energy use is skyrocketing – nearly 40% of all new energy installations in 2016 were solar. The solar workforce has tripled since 2010, reaching some 270,000 workers currently, edging out the number employed in natural gas and nearly doubling the number employed in coal. Of course, there's continued uncertainty under the Trump administration, which may not pursue aggressive alternative energy policies. (See also: 2017: A Turning Point for the Solar Industry.)

That said, depending on your point of view, the sunny outlook for the industry may mean that the time is right to jump into solar. If you're considering solar exposure for your portfolio, here are the top picks for 2018. Note: All figures are current as of Jan. 11, 2018.

First Solar, Inc. (FSLR)

After a somewhat disappointing 2016, when revenue was down nearly 20% from 2015, First Solar had an impressive 2017. After a strong first quarter revenue report of $891 million, second quarter revenue came in at $623.3 million, well above consensus estimates of $556 million but down 33% from the same period in 2016. The results for the third quarter were even more impressive – First Solar reported third quarter revenue of $1.09 billion, representing year-over-year growth of 60% and crushing the consensus estimate of $824.2 million.

Currently, the stock is trading at about $76. The solid third quarter earnings report was enough to send the stock soaring by over 20% in the trading session on Oct. 27, and the shares posted additional gains of over 13% in the first part of December. The momentum appears to be continuing in the first month of 2018, and the recent share price increases have brought First Solar's market cap to $7.965 billion. (See also: Buy First Solar on Better Products: Deutsche Bank.)

SunPower Corporation (SPWR)

SunPower lost more than 70% of its value over the course of 2016, a figure that strikes fear in the heart of the average investor. Bankruptcy is a definite concern with some solar companies, but SunPower is majority owned (66%) by petroleum giant Total S.A. (TOT), which is propping the solar company up with credit and even purchasing solar panels for its 5,000 gas stations. SunPower is plowing money into new technology from Congenra Solar to boost its solar panels' efficiency and move into utility-scale projects, which could be a game changer for the balance sheet.

SunPower has a market cap of $1.322 billion. The stock is currently trading at $9.47 per share. Third quarter 2017 revenue of $533.6 million beat analysts' expectations but was down 30.7% from 3Q 2016. With a decision regarding potential tariffs on solar panels imported to the U.S. due later in January, there are some concerns that such a policy could affect SunPower because it relies on manufacturing facilities in Asia. (For more, see: First Solar and SunPower: Effects of Solar Panel Tariffs.)

Vivint Solar, Inc. (VSLR)

Vivint is a residential solar company that provides both rooftop solar and storage solutions. The stock had a bang-up month in June, rallying over 80% after Goldman Sachs analysts upgraded the stock to Buy and nearly doubled their price target from $3.50 to $6.00 per share. However, Vivint shares subsequently gave up the majority of those gains. Even so, the stock ended 2017 up nearly 56% for the full year and is currently trading at $4.10 per share.

The volatility experienced by the stock in recent months could give investors pause, but the company's move to a cash and loan sales model and its national footprint could make it an attractive acquisition target. Plus, Vivint Solar has some of the lowest solar installation costs in the country. Legislation pending in Nevada that will allow solar owners to sell excess electricity to the utility companies at 95% of retail prices could mean a huge revenue boost for Vivint if it restarts operations in the state.

First quarter 2017 revenue of $53 million was up more than 200% over the prior-year period, and 2016 total revenue of $135 million was up more than 110% from 2015. The company turned profitable in the third quarter of 2017, generating a gross profit of $16.4 million for the period that ended Sept. 30. (For additional reading, check out: Sunny Times Ahead for the Solar Sector.)

Want to learn how to invest?

Get a free 10 week email series that will teach you how to start investing.

Delivered twice a week, straight to your inbox.