(Reuters) - Twitter Inc TWTR.N said on Thursday it may become profitable for the first time next quarter after slashing expenses over the past year and ramping up deals to sell its data to other companies, which could help to break its reliance on advertising for revenue.

Shares of Twitter soared more than 18 percent to $20.31 in afternoon trading. The company also said user growth resumed in the third quarter after stalling in the prior three months.

Twitter has never had a profitable quarter based on generally accepted accounting principles (GAAP), but said it “will likely be GAAP profitable” in the fourth quarter if it hits the high end of its estimates.

The social media company has struggled to convert its appeal among celebrities and public figures such as U.S. President Donald Trump to attract users and advertisers amid fierce competition from Facebook Inc FB.O and Snap Inc's SNAP.N Snapchat. It has worked in recent months to sign live-streaming deals and make other changes to improve user experience.

Revenue from data licensing and other sources in the third quarter was $87 million, Twitter said, up 22 percent from a year earlier. That helped cushion an 8 percent decrease in advertising revenue.

Twitter said it signed a “significant number” of enterprise deals in the third quarter, which would help stabilize its revenue flow. It did not name the companies it had inked deals with.

Twitter reported quarterly revenue of $590 million, down 4 percent from a year earlier, attributing much of the decrease to a previously announced decision to wind down its TellApart advertising product.

Analysts on average had expected revenue of $587 million, according to Thomson Reuters I/B/E/S.

San Francisco-based Twitter also disclosed that it had discovered an error in how it had measured its user base since 2014 and revised its estimates downward, but said the difference amounted to less than 1 percent.

The company reported 330 million monthly active users in the quarter ended on Sept. 30, up 4 million from a quarter earlier, helped by email and push notifications.

In the United States, where growth had stalled earlier this year, the number of users rose to 69 million from 68 million.

FILE PHOTO: The Twitter logo is displayed on a screen on the floor of the New York Stock Exchange (NYSE) in New York City, U.S., September 28, 2016. REUTERS/Brendan McDermid/File Photo

Analysts on average expected 330.4 million monthly active users worldwide and 69 million in the United States, according to financial data and analytics firm FactSet.

Twitter said that in past estimates it had wrongly counted people who logged into applications associated with the company's Fabric software platform, which Twitter sold this year to Alphabet Inc's GOOGL.O Google.

Unlike Facebook, Twitter does not disclose daily active users, but says that number is less than half the monthly figure.

The decline in quarterly revenue was the third since Twitter’s debut as a public company in 2013 and raised concerns about growth among some analysts.

“Yes, they grew 4 million MAU sequentially, which is good enough for the stock to stay at current levels, but revenue growth remains a problem,” said Michael Pachter, managing director, equity research at Wedbush Securities.

“It’s great that they are controlling expenses and generating EBITDA growth, but investors want to see faster MAU growth and some revenue growth,” Pachter said.

Twitter Chief Executive Jack Dorsey said on a conference call that the company was trying out ways to attract and engage more users.

“We’re playing a lot with better matching people with their interests and with topics they care about. This is an area of experimentation,” he said.

Also on Thursday, Twitter said it banned advertisements from accounts owned by Russian media outlets Russia Today and Sputnik, citing allegations by U.S. intelligence agencies that the outlets tried to interfere with the 2016 U.S. election.

The company has been under scrutiny from U.S. lawmakers as part of a broad investigation into Russian influence in the 2016 election.

COST CUTS, SMALLER LOSS

Twitter’s net loss narrowed to $21 million, or 3 cents per share, from $103 million, or 15 cents per share, a year earlier. Excluding items, the company earned 10 cents per share.

Analysts expected a profit of 6 cents per share, according to Thomson Reuters I/B/E/S.

Twitter cut expenses by 16 percent from a year earlier. Stock-based compensation declined 36 percent, but Twitter said the cuts were broad-based, covering sales and marketing and research and development.

Expenses would selectively increase moving forward, the company said.

Chief Operating Officer Anthony Noto told analysts that Twitter was still in the early stages of exploring a product around its TweetDeck interface.

“We’ve only done concept tests,” he said.

The company has stepped up efforts to keep people hooked through live-streaming deals, including for concerts, professional golf and news programs.

Twitter last month began testing tweets as long as 280 characters, double the existing cap, and has announced plans to toughen its rules on online sexual harassment.

Up to Wednesday's close, Twitter's stock had risen 5.2 percent this year, compared with a 30.4 percent gain in the S&P 500 information technology index .SPLRCT.