Shares of Mattel jumped as much as 7% in extended trading Thursday after the company posted a narrower-than-expected loss in the second quarter and reported strong sales of its Barbie dolls and Hot Wheels cars.

"This quarter further demonstrates the continued momentum of our multi-year turnaround strategy," Ynon Kreiz, chairman and CEO of Mattel, said in a statement.

Mattel had struggled in the wake of Toys R Us' bankruptcy and eventual closure last year. Notably, this is the first quarter in which shipments to Toys R Us don't affect comparisons. Toys R Us shut all of its locations by June 29, 2018.

Mattel's net loss narrowed to $108 million, or 31 cents per share, from a loss of $241 million, or 70 cents a share, in the year-ago period.

Adjusted for one-time items, Mattel lost 25 cents a share. Analysts had predicted that Mattel would lose 40 cents per share.

The company's net sales rose 2% to $860.1 million in the quarter, ended June 30, topping the $813 million analysts had expected, according to data from Refinitiv.

In the quarter, sales of Barbie rose 9% and sales of Hot Wheels jumped 5%. However, once again, American Girl and Fisher-Price both saw sales decline.

"Fisher-Price core is showing an improving trend," Kreiz said on an earnings call Thursday. "We expect further progress in the second half of the year."

The company is set to release new products for younger children based on "Toy Story 4" and "Frozen 2."