Solar investors “aren’t nearly as negative as they were the day after the election,” said Andrew Hughes, an alternative energy analyst for Credit Suisse.

One reason for that shift seems to be a budding bromance between Mr. Trump and Mr. Musk. The president-elect invited Mr. Musk to Trump Tower in December as part of a group of technology executives and named him to his strategic and policy forum of business leaders.

And Mr. Musk was with a group of manufacturing executives at a White House meeting this week at which, according to a participant, he broached the subject of a carbon tax. Surprisingly, Mr. Trump didn’t reject it out of hand.

For his part, Mr. Musk this week endorsed Rex W. Tillerson, a pillar of the fossil fuel establishment as chief executive of Exxon Mobil, for secretary of state.

Mr. Jonas said that the “strategic relationship between Tesla leadership and the new administration is an important development” in his decision to upgrade Tesla stock.

“That Trump would be relying on Musk as an adviser has come as quite a surprise to many people,” Mr. Jonas said.

A major fear of investors in solar power was that a Trump administration would end the federal subsidies so reviled by fossil fuel proponents. While that remains a concern, the most recent jobs data suggests that the subsidies have led to a surge in new well-paid jobs, exactly what the president has advocated.