Twitter showed a healthy spurt of user activity in the first quarter — netting 9 million monthly users, its biggest gain in two years — and topped analyst expectations on revenue and earnings.

Twitter’s Q1 revenue totaled $548 million, down 8% year-over-year. It was the first drop in sales since the company went public, but the top line exceeded Wall Street expectations of $512 million. The company reported adjusted earnings of 11 cents, well over analyst forecasts of EPS of 1 cent. Twitter posted a net loss of $61.6 million, or 9 cents per share, as stock-based compensation totaled $117 million.

Twitter shares were up more than 11% in pre-market trading Wednesday over the previous closing price of $14.66. However, that’s still well below the 52-week high of $25.25 per share.

For the first three months of 2017, Twitter’s monthly active user base increased 9 million (including 3 million in the U.S.) sequentially, to reach an average of 328 million. The company said daily active usage increased 14% year-over-year, the fourth consecutive quarter of accelerating growth, but didn’t disclose actual figures for its average daily user base.

“We’re delivering on our goal to build a service that people love to use, every day, and we’re encouraged by the audience growth momentum we saw in the first quarter,” Twitter CEO Jack Dorsey said in announcing the results. “While we continue to face revenue headwinds, we believe that executing on our plan and growing our audience should result in positive revenue growth over the long term.”

Video remains a key plank in Twitter’s strategy, with the company’s ultimate long-range goal to be to deliver nonstop live video on the platform. The company will make its debut at the 2017 Digital Content NewFronts on May 1, where it will pitch its upcoming programming slate to marketers. According to Twitter, video in Q1 continued to be its single biggest ad format in terms of revenue.

In Q1, Twitter said, it streamed more than 800 hours of live video from content partners across more than 450 events, reaching 45 million unique viewers. That’s up 31% from the previous quarter, which Twitter said was its first full quarter of live-streaming premium content. (Q4 content included the NFL’s “Thursday Night Football”; Amazon beat out Twitter to secure those streaming rights for next season.) In the second quarter, Twitter plans to launch a free weekly Major League Baseball game, and has a pact with IGN to provide an exclusive live stream of the E3 video-game expo in June.

Of Twitter’s Q1 live video, 51% was sports and eSports, 35% was news and politics, and 14% was entertainment (including red-carpet coverage of the 2017 Grammy Awards). About 60% of its unique video viewers are outside the U.S., about 55% are under the age of 25. Twitter says it has signed more than 200 content partners to date.

Total ad revenue for Q1 was $474 million, down 11%, even as Twitter’s total ad impressions increased 139% in Q1. That’s because average cost per engagement plummeted 63% year-over-year with Twitter citing a “higher mix of video engagements” and, to lesser extents, lower ad rates and improved engagement rates across most other ad formats.

For Q2, Twitter said it expects adjusted earnings to be between $95 million and $115 million and stock-based compensation to be between $115 million and $125 million.

On the call with analysts, Twitter execs touted progress on safety, including recently stepping up efforts to identify and shut down abusive user accounts. On another front, Dorsey said Twitter is continuing to address spam bots, which he said make up less than 5% of accounts; still, that would represent around 16 million accounts given the current user base.