"Margot is the ideal producer and actress to bring Barbie to life on screen in a fresh and relevant way for today's audiences," Toby Emmerich, chairman of Warner Bros. Pictures Group, said in a statement.

Robbie will co-produce the Barbie film, alongside Rom Ackerley and Josey McNamara, under the LuckyChap Entertainment banner.

Shares of the company surged as much as 5 percent on the news Tuesday, before giving up some of its gains.

Toy company Mattel said Tuesday it is partnering with Warner Bros. to bring the iconic doll to theaters with Academy Award-nominated actress Margot Robbie to star. This is the first movie deal announced by Mattel Films, which launched in September.

Robbie has gained fame for her portrayal of Harley Quinn in "Suicide Squad," Tonya Harding in "I, Tonya" and Jane Clayton in "The Legend of Tarzan."

Ynon Kreiz, who took the helm at Mattel last April, has previously said he plans to take the struggling company's iconic toy brands and expand them into other potentially moneymaking areas. Movies are just one of those avenues.

Over the last 12 months, shares of Mattel have fallen more than 27 percent, as the company has been hurt by weak sales of its iconic brands such as American Girl Doll and Fisher-Price. In recent years, more children have gravitated toward video games and electronics instead of traditional toys. It was also hit hard by the bankruptcy of Toys R Us.

Despite overhauling the company's management team, suspending its dividend and developing plans to cut $650 million in costs, Mattel has been unable to revive sales. Last year, the company announced it would cut 2,200 jobs, or about 22 percent of its global non-manufacturing workforce, and shutter its New York office, affecting about 100 employees.

Mattel is expected to report its fourth-quarter earnings on Feb. 1, according to FactSet.

"Mattel is the owner of one of the strongest catalogs of children and family entertainment in the world — think Barbie, Hot Wheels, American Girl, Fisher-Price, Masters of the Universe, Thomas the Tank Engine ... Ageless, timeless, generational, iconic brands," Kreiz told CNBC's "Squawk on the Street" in October.

Notably, sales of Barbie dolls were up 17 percent globally in the third quarter, with 22 percent growth in North America.

Kreiz said at the time he wants to restore Mattel to being a "high-performing" toy company and to capitalize on its intellectual property by expanding into film, television, live events, video games and consumer merchandise.

Mattel's rival Hasbro has excelled in translating its properties to successful television shows, movies and online videos. Theatrical releases of its six "Transformers" films alone have grossed more than $4.66 billion globally, according to Box Office Mojo.

Mattel has previously ventured into web series, launching online shorts with brands such as Barbie, Monster High and Polly Pocket. However, while Barbie has been featured in a number of animated home-release films, she has yet to grace the big screen in a Mattel-produced film. (She did appear in Pixar's "Toy Story 2" and "Toy Story 3.")

The upcoming Barbie film will be live action, Mattel said.

WATCH: Mattel launches new film division