Zynga (ZNGA) late Thursday said it will axe 15% of its workforce as it seeks to cut up to $35 million in costs and revive its struggling bottom line.

The Seattle-based “Farmville” developer will lay off 314 people and reduce spending on data-center infrastructure. It will record a $15 million to $17 million restructuring charge in the first quarter.

"Over the last 7 months, our teams have been working with a sense of urgency,” Zynga CEO Don Mattrick said in a statement. “We believe that Q1 will be a solid foundation for that growth and we expect substantial improvements for the remainder of the year.”

At the same time, the company is spending $527 million to buy privately-held game maker NaturalMotion and its 260 employees across Oxford, London, Brighton and San Francisco. The startup makes the "CSR Racing" and "Clumsy Ninja" games.

Zynga said the transaction is expected to be accretive to non-GAAP earnings and generate bookings in the range of $70 million to $80 million. Mattrick said the buy is the "right step at the right time," enabling the company to "significantly expand" its creative pipeline.

The announcements come as Zynga halved its quarterly loss to $25.2 million, or three cents a share, compared with a year-earlier loss of $48.5 million, or six cents, despite a 43% decline in revenue to $175 million from $311 million last year.

Monthly unique users in the fourth quarter was 80 million, down from 167 million in the year-earlier quarter, while the number of players actually paying for games fell to 1.3 million from 2.9 million. 

Analysts on average in a Thomson Reuters poll called for a worse loss of four cents on weaker sales of $138 million. 

Shares of Zynga were flat after hours. They closed up 4% in regular trade on Thursday to $3.56 and are down 62% since their December 2011 initial public offering.

Follow Jennifer Booton on Twitter at @Jbooton