Shares of Blue Apron rallied Thursday after the company reported better-than-expected first-quarter earnings.

The meal kit company's stock rose more than 9 percent at one point in premarket trading after Blue Apron said that its planned reduction in marketing contributed to a narrower-than-expected loss.

Here's how the company performed:

Earnings: a loss of 17 cents per share vs. a loss of 24 cents per share estimated by Thomson Reuters

Revenue: $196.7 million vs. $197.2 million forecast by Thomson Reuters

"We are pleased with the progress we achieved this quarter, including significant improvement in operational efficiencies as reflected by our margin performance, which was the strongest we have seen since the second quarter of 2016," CEO Brad Dickerson said in a statement Thursday.

Blue Apron has been struggling to overcome well-publicized operational issues that have dragged its stock down more than 47 percent since it started trading in late June. Shares have slipped from $11 to just under $2 during that period.

While the meal kit company saw the number of customers increase 5 percent from the last quarter, it's still struggling to keep subscribers in the long term. Year over year, the number of customers buying Blue Apron's meal service is down 24 percent.

Dickerson, who became CEO in late November, said scaling back on marketing contributed to slowing customer acquisition.

The company spent $39.3 million, or 20 percent of revenue, on marketing in the first quarter. In the period last year, Blue Apron spent $60.6 million on marketing, or 24.8 percent of its revenue.

Blue Apron started to ramp up its marketing in late December and in the first quarter as it aimed to attract more new customers and increase engagement with its current users.

Average revenue per customer increased to $250 from $236 for last year.

"We look forward to building on this momentum as we continue to optimize our direct-to-consumer business, create new products that complement our core offering, and leverage new distribution channels — including our newly launched pilot program with Costco — to expand the reach of our strong brand to more households across the country," Dickerson said.

On the earnings call, Dickerson said that Blue Apron will soon launch a number of new meals and recipes including special occasion boxes, appetizers and desserts.

Blue Apron reported a net loss of $31.7 million or 17 cents per share, in the three months ended March 31, compared with a loss of $52.2 million, or 78 cents per share, a year earlier.

Wall Street had expected the company to report a loss of 24 cents per share.

Blue Apron said revenue fell to $196.7 million from $244.8 million, reflecting a planned reduction in marketing. Analysts had expected revenue of $197.2 million, according to Thomson Reuters estimates.