What happened

Shares of Twitter Inc. (NYSE:TWTR) have surged 81% through the first half of the year, according to data from S&P Global Market Intelligence, as the popular site has turned profitable, made important changes to its platform, and won praise from Wall Street. After years of disappointing the market with flatlining user growth and an inability to define its purpose (as opposed to rival and social media juggernaut Facebook), the company appears to be turning a corner.

As the chart below shows, the stock's growth this year has come in two waves, first following its fourth-quarter earnings report in February, and then in June as the stock gained acceptance into the S&P 500.

TWTR Chart

TWTR data by YCharts.

So what

Twitter's 2018 rally got going on Feb. 8 as the stock jumped 12% when it reported fourth-quarter earnings for 2017 and turned in its first GAAP quarterly profit. In the quarter, Twitter actually said it lost domestic users, but the market was willing to overlook that in favor of the company's improving financial numbers. 

A Twitter logo outlined in lightbulbs by an open window.

Image source: Twitter.

Globally, the company reported its fifth straight quarter of double-digit growth in daily active users (DAU), as they increased 12%. And revenue growth returned as the top line increased 2% to $732 million, with advertising revenue on Twitter's owned-and-operated sites up 7%. 

It's unclear exactly what drove the increase in revenue, though advertisers appear to be cheering the company's efforts to crack down on harassment and to make the site easier to use and more welcoming to new users. 

The company's second big rally of the year came as the stock won a listing on the S&P 500, sending shares up 5% on June 5 and anchoring a broader surge that saw shares climb nearly 20% over a week. The news signals that the S&P sees the stock as one of the 500 most important in the U.S. and also means that Twitter will be a part of S&P 500 index funds. In other words, those funds all had to buy the stock, pushing shares higher.

Now what

Twitter's revenue growth surged in its first quarter with the top line up 21%. There was 28% growth in owned-and-operated advertising as the company made improvements to deliver increased return on investment to advertisers, and budgets are shifting from television to digital. With the stock having nearly doubled this year, Twitter's valuation is high at a P/E of 83, but investors look at Facebook and Alphabet and see huge potential in online advertising. If Twitter can maintain its current growth rate, the stock could move even higher.