Tesla delivered 4,900 Model S sedans in the first quarter. Photo credit: Tesla Motors

Tesla Motors (TSLA 12.19%) announced a first-quarter profit of $15 million, excluding some items, late on Wednesday, a result driven by strong sales of the company's award-winning Model S sedan.

Tesla's $0.12 per-share profit was well above Wall Street's consensus expectation of $0.04 a share, according to Thomson Reuters. Needless to say, it was also a huge improvement over Tesla's $0.76-per-share loss in the year-ago quarter.

Shares moved sharply higher in after-hours trading on the news.

Tesla's first-ever profit comes on stronger-than-expected sales
This was Tesla's first-ever quarterly profit in its 10 years of existence, and it comes as the Silicon Valley start-up continues to ramp up production and sales of the Model S, its second vehicle and the first to be mass-produced in Tesla's California factory.

Tesla said that it produced more than 5,000 Model S sedans during the first quarter, and that it "recognized 4,900 vehicles as revenue," meaning that they were fully paid for and delivered to customers.

That's a strong result. CEO Elon Musk said in a statement that it was made possible by Tesla's focus on improving production efficiency, something that in turn was made possible as the company's processes (and its suppliers) got up to full speed. That focus on improvement led to a 40% decline in the time required to build a Model S between December and March, Musk said.

A big jump in revenue driven in part by sales of tax credits
Tesla's revenues rose to $562 million in the first quarter, an 83% increase from the fourth quarter of 2012. Not all of that was from Model S sales: Musk said that Tesla continued to supply electric powertrains and battery packs to Toyota (TM 0.89%) for use in the Japanese giant's all-electric RAV4 SUVS.

Tesla also continues to work with Mercedes-Benz on development of a small electric car; that work generated $7 million in revenue during the quarter, Musk said.

Tesla acknowledged that it had made $68 million, or 12% of its total revenue during the quarter, via the resale of "Zero Emission Vehicle," or ZEV, tax credits issued by the state of California.

Analysts had recently speculated that the sale of ZEV credits could account for a significant portion of Tesla's earnings. Under California's arcane green-car laws, Tesla receives a credit for about half of the cars it sells. It then resells its credits to other automakers who don't yet meet California's ZEV sales requirements. Tesla says it expects that revenue to decline in time, as less of its total production will be eligible for the credits (because they'll be sold overseas) and as the market price for ZEV credits declines.

The outlook: mostly bright and shiny, Tesla says
Tesla's gross margin was 17% in the first quarter, up from 8% last quarter. That's a good increase, but it's still short of the 25% promised by Musk by the end of this year. Not to worry: Tesla reaffirmed its guidance on that front, saying that it would have a 25% gross margin in the fourth quarter of 2013 -- even if revenues from the sale of ZEV credits fell to zero.

Tesla expects to build about 5,000 cars during the second quarter, but it only expects to record about 4,500 sales, as some of its second-quarter production will be in transit to Europe at quarter's end. For the full year, Tesla raised its guidance to 21,000 Model S deliveries from the 20,000 it had previously expected.

And on profits? Tesla says a small loss is likely next quarter, because of costs of launching the Model S in Europe and the deferred recognition of some revenue caused by the accounting requirements of the company's new quasi-lease program. Other expenses, most related to the development of Tesla's next model, will weigh somewhat in the current quarter.

We'll have more in-depth coverage of Tesla's first-ever profitable quarter in coming days. Meanwhile, what do you think? Does this profit mean that Tesla is here to stay? Or does the company still have more work to do? Scroll down to leave a comment and let me know your thoughts.