July 26 (Reuters) - Mattel is banking on the box office success of the "Barbie" movie to help drive doll sales in the second half of the year, CEO Ynon Kreiz said on Wednesday, as the toymaker recorded a strong performance in July following the buzz around the film.

The company also posted a surprise profit in the second quarter and its sales exceeded market expectations.

Strong demand for the movie-related toy line and licensed consumer products is expected "to continue to perform well in the back half of the year," Kreiz said in an interview to Reuters.

The "Barbie" movie made a record-breaking debut in cinemas over the weekend, with $162 million in ticket sales in the United States and Canada.

The toymaker's adjusted profit for the quarter ended June 30 came in at 10 cents per share, compared to analysts' average estimate of a 2 cents loss, as per Refinitiv data.

The company posted a per share loss in the last quarter, dogged by a broader slowdown in the toy industry and an ongoing inventory adjustment by retailers after 2022's dour holiday season.

However, it said "the retail inventory correction is mostly behind us".

Mattel's worldwide gross billings - the amount invoiced to customers - for its Barbie segment fell 6% in the quarter, coming behind its Hot Wheels brand, which rose 10%.

Net sales fell 13% to $1.09 billion on a constant currency basis, but still beat analysts' estimates of $1 billion.

Mattel maintained its full-year sales forecast, which it expects to be flat from last year, and adjusted profit per share between $1.10 and $1.20 per share.

Earlier in the day, Mattel's Chief Operating Officer Richard Dickson, who helped revive the Barbie brand, was appointed CEO of apparel maker Gap. He is set to leave the company on Aug. 3. (Reporting by Savyata Mishra in Bengaluru; Editing by Pooja Desai)