Tesla said Wednesday that the first two styles of its solar roof will be priced at about $21.85 per square foot.

That price is slightly lower than the $24.50 per square foot price Consumer Reports had said Tesla would need to meet to compete with asphalt roofs, once savings from electricity bills were factored in over the roof's expected lifetime.

Many had expressed skepticism that Tesla's product would be as affordable as the company claimed. But after the release of the pricing, Tesla shares closed up more than 1 percent Wednesday.

Tesla said it is releasing the first two styles of the glass tiles — "black glass smooth" and "textured" versions — out of the four planned styles the company has shown off to the public.

A curved, reddish "Tuscan" style and a style that resembles slate rock tiles are expected "in early 2018," according to Tesla.

The shingles have three layers — a high-efficiency solar cell, a specially designed film to mask the cell from viewers on the ground, and a top layer of tempered glass. Tesla has said it will sell the roof alongside other products, such as its Powerwall wall battery.

The product will come "with a warranty for the lifetime of your house, or infinity, whichever comes first," the company said in a blog post.

Tesla CEO Elon Musk had announced on Twitter Wednesday morning that Tesla would begin selling its solar roof tiles. Musk has previously said that he wanted to do for solar power what Tesla was attempting to do with electric cars — develop an alternative-energy product that would rival or exceed conventional ones in attractiveness and utility.

However, the news comes during an interesting, even trying, time for some U.S. solar companies. A recent report from GTM Research said the second half of 2016 showed the first significant decline for U.S. solar companies.

For Tesla, one of the obvious barriers to achieving that is cost. Previously, Consumer Reports had determined that a textured glass tile solar roof should cost no more than $73,500, including installation, to be competitive with an asphalt roof. That price factors in the about $2,000 a year a household would save on electricity bills in some of the country's more favorable solar markets, such as California, Texas and North Carolina.

The company also created a "Solar Roof calculator" that allows customers to gauge the cost of an installation. Tesla plans to offer financing in late 2017, but in the meantime, customers can finance with a personal loan, a home improvement loan, a home equity line of credit, or a second mortgage.

Whether there is demand for a solar roof still remains something of an open question.

"I do think that this is going to be competitive in specific geographic locations, mainly based on costs of electricity," said ARK Invest analyst Sam Korus, in an interview with CNBC. "The fact that they are starting in California makes perfect sense, since you have a lot of sun and high energy costs."

Tesla's recent decision to scrap the door-to-door sales common in the solar energy industry also may end up serving as an advantage, Korus said. "One of the biggest hindrances to residential solar was the cost of selling it and installing it, so getting rid of that door-to-door sales force is definitely a step in the right direction."

For now, Tesla is taking orders online, but the company has said before that it plans to offer solar products in its stores as well. Customers coming to the stores to buy cars are conceivably already inclined to consider installing solar panels on their homes.

Tesla is not the first company to attempt a solar panel that is integrated into a roof, and recent history is littered with failures, said Raymond James analyst Pavel Molchanov, in an email to CNBC.

He said companies such as Energy Conversion Devices, Ascent Solar, Solarion and MSK were all built on the anticipation that demand for "building-integrated photovoltaics" (BIPV), an industry term for such products, would surge.

But demand did not surge. Energy Conversion Devices was liquidated, Ascent Solar is trading at around 1 cent per share, Solarion was acquired in bankruptcy, and MSK was bought by Suntech, which later went bankrupt, Molchanov said.

Molchanov also said that Tesla's disclosed numbers are "rule of thumb estimates" that need to be taken with a grain of salt. Costs will always vary depending on the actual roof — which Molchanov said is true of rooftop solar generally.

Also, he added, Tesla's numbers are projections that will have to be updated once actual manufacturing and installation begins.

"Again, bearing in mind how lackluster BIPV adoption has been historically," he said, "at this point I wouldn't expect significant sales until 2020 or so."