NEW YORK — It's the perfect fit.

Two of the world's top bra makers are coming together in the biggest development in the $11.5 billion underwear industry in years.

Hanesbrands, which makes the Wonderbra, said Tuesday that it agreed to buy bra and underwear company Maidenform Brands Inc. for about $547 million. The deal would add brands like Maidenform, Flexees and Self Expressions to the Hanesbrand roster that includes Playtex, Bali, Champion, Wonderbra and its namesake Hanes.

The merger comes as traditional bra and underwear makers are facing tough competition from specialty stores such as Victoria's Secret that focus on frilly designs and newer rivals like Spanx that make shapewear that promises to control and smooth out bulges.

"Maidenform has great brands that consumers trust," said Hanes CEO Richard A. Noll. "Combining the complementary strengths of both companies creates a lot of growth opportunities."

Bras, which are as much about fashion as they are about function these days, are the biggest sellers in the intimate apparel arena, making up about 48 percent of all sales, according to research firm IBIS world. Panties make up about 24.8 percent of sales, sleepwear makes up about 22 percent and shapewear 5.2 percent, according to IBIS figures.

The bra and underwear industry has growth spurts when new trends come along. Think: boy shorts three years ago, for example, or shapewear over the past two years. But when it comes to what they're wearing underneath their clothes, Americans have cut back on their shopping habits since the recession.

"It used to be women invested in their intimates, now they're investing either in their bra wardrobe or panty wardrobe," said Marshal Cohen, chief industry analyst with The NPD Group. "The economy changed the way we buy; we're not buying everything all at once anymore."

The industry has been playing with sizing in recent years to get growth. From 20 sizes 20 years ago, there are now more than 90 sizes, said Kate Terhune, marketing manager for Intimacy, a chain that specializes in helping women find the right size undergarments. And HanesBrands said Wednesday that Maidenform's average-figure bra business will complement its full-figure bra collection.

Ninety-one-year-old Maidenform was a pioneer in the bra industry in the 1920s, patenting the first modern-seamed "uplift" bra in1925. But the Iselin, N.J. has been suffering from losses, hurt by tough competition in the shapewear business and lower sales from department stores, where Maidenform products are traditionally sold.

The company said it has been evaluating its strategic options. Maidenform CEO Maurice Reznik said that the deal was appealing in part because it provides the necessary infrastructure and resources to help grow its business.

Matthew Butlein, president of freshpair.com, an online underwear retailer, said he thought the move was a smart one for Maidenform since the company can use Hanesbrands marketing team to get more exposure for its brands, as well as its Visr service, a self-service wholesale portal that lets smaller boutiques place underwear orders directly instead of dealing with sales reps. Hanesbrands, for its part, will get more youthful lines from Maidenform, since Hanesbrands lines tend to skew older.

Both companies' boards unanimously approved the acquisition, which is expected to close in the fourth quarter. It still needs approval from Maidenform shareholders.

Hanesbrands shares rose $4.15, or 7.8 percent, to $57.51, after earlier reaching a 52-week high of $59.35. Maidenform shares rose $4.31, or 22.6 percent, to $23.40. The stock has traded between $16.50 and $26.37 during the past 52 weeks.

Hanesbrands, based in Winston Salem, N.C., was founded in 1901 as a men's hosiery business. It expanded into men's underwear in 1920 and added women's bras in 1971 when it acquired Bali Brassiere Company.

Hanes has a 14.3 percent share in the underwear market, according to Euromonitor International, behind only L Brands, which owns Victoria's Secret. Maidenform, meanwhile, is the fifth largest player in the market with a 2.5 percent share.

The deal fits into the company's strategy to make acquisitions that will boost earnings. The Maidenform deal is expected to add to earnings within 12 months, with full benefits in three years. It acquired GearCo., which sells licensed logo apparel in college bookstores, in 2010, and acquired TNF Group Pty Ltd., an activewear supplier in Australia, in 2011.

Hanesbrands will pay $23.50 per share, a 23 percent premium to Maidenform's $19.09 Tuesday closing price. The companies put the deal's value at about $575 million.

Hanesbrands anticipates being able to potentially lower the costs of Maidenform products for retailers and consumers. Currently Maidenform sources its products from third-party manufacturers. With the acquisition, HanesBrands said Maidenform will now be able to take advantage of HanesBrands' company-owned manufacturing, which is supplemented by third-party manufacturers.

Hanesbrands spokesman Matt Hall said it was too early to say whether there would be layoffs related to the acquisition, but said there is "typically overlap of independent company corporate functions that would be redundant."

__

AP Writer Michelle Chapman in New York contributed to this report.