Mattel (MAT 0.67%) may be making a comeback.

With shares of the toymaker down 14% over the past year, versus an S&P 500 that's up 23%, it might not feel much like Mattel is on a roll. But as of Thursday, it's just turned in its fifth straight earnings beat, and its second consecutive profitable quarter, sending its shares up 2.6% in after-hours trading.  

Mattel reported earnings after close of trading Thursday. Although the analyst consensus was for earnings per share of just $0.01 in the fourth quarter, it ended up earning $0.11 in adjusted EPS. Toy sales for the fiscal fourth quarter of $1.67 billion likewise trumped expectations for just $1.5 billion in sales.  

Tiny toy cars

Image source: Getty Images.

Mattel's sales actually declined in the fourth quarter by 3%, in part because of weak sales during the holiday season at one of its important retail outlets, Target (TGT 1.28%). Nevertheless, CEO Ynon Kreiz argued that Mattel has reached "an important inflection point in our turnaround."

Kreiz said, "We stabilized our topline after five consecutive years of revenue decline, continued to significantly improve profitability, and achieved positive operating cash flow and positive free cash flow for the first time in three years."

For the quarter, Mattel's gross profit margin increased 180 basis points to 48.4%. More importantly, for the year as a whole, sales were flat year over year (not declining) at $4.5 billion, with gross margin up 420 basis points to 44%, operating profits turning positive ($39 million), and free cash flow positive at $65 million -- the first time Mattel has managed that in three years.