Gap Inc. is splitting into two.

The retailer said Thursday that it’s creating two independent publicly traded companies — low-priced juggernaut Old Navy and a yet-to-be-named company, which will consist of the iconic Gap brand, Banana Republic and the lesser-known names Athleta, Intermix and Hill City.

The San Francisco-based company said the spinoff will enable each company to focus on flexibility and pare costs.

The company also said it will be shuttering 230 Gap brand stores over the next two years. A year ago, the Gap brand had 725 stores worldwide. After the closures, which also include the 68 stores it shuttered this year, the chain will be down to roughly 427 stores. It expects to have more than 40 percent of Gap’s business coming from online after the restructuring.

Gap’s stock surged 25 percent in after-market trading.

The split-up, which followed a comprehensive board review, comes as Old Navy has been thriving, while Gap still hasn’t been able to regain its footing despite numerous attempts to fix the business. Once the go-to place for casual clothing, Gap has been mired in a sales funk for years, hurt by increasing competition from the likes of Target and Amazon.

Analysts applauded the move.

“This is great news for Old Navy, no longer having its success consistently outweighed by sluggish performance by Gap,” said Tiffany Hogan, senior analyst at Kantar Consulting. “But for the Gap, this seems like potentially a last significant effort to help the brand find its place in a market where it has lost relevance.”

She noted that in order for Gap to succeed, it needs to find the right mix of style and basics for its stores, while getting a better grasp of who its customer is.

Separately, Gap Inc. reported that Gap’s overall sales at stores open at least year were down 1 percent during the fiscal fourth quarter. By division, the Gap brand posted a 5 percent drop, while that figure at Banana Republic was down 1 percent. Old Navy posted sales that were unchanged from a year ago. But that was on top of a 9 percent gain in the year-ago period.

“It’s clear that Old Navy’s business model and customers have increasingly diverged from our specialty brands over time, and each company now requires a different strategy to thrive moving forward,” said Robert Fisher, Gap Inc.’s chairman.

Gap’s current CEO, Art Peck, will hold the same position at the new company after the separation. Sonia Syngal, current CEO of Old Navy, will continue to lead the brand as a stand-alone company, which has about $8 billion in annual revenue. The new company that Peck will run has about $9 billion in annual revenue.

During a conference call with investors Thursday, Peck called the separation a “unique and catalyzing moment to simplify what we are doing and how we’re doing it.”

Upon separation, Gap Inc. shareholders are expected to receive a pro-rata stock distribution and as a result will own shares in both the new company and Old Navy in equal proportion. The deal is expected to close in 2020.

The new company will be based in Gap Inc.’s current headquarters and Old Navy will remain at its current headquarters, both located in San Francisco.

Gap’s shares rose $6.50 to $31.90 in extended trading after the split-up was announced.