The third-largest sportswear maker in the United States has closed stores, cut jobs and rolled back promotions to bolster profit margins as it tries to recover from a bruising fight for market share with bigger rivals Nike Inc and Adidas.

The surge in shares reflect investors' confidence in the company's turnaround as well as its expansion in international markets to offset weakness in the United States, where it had fallen behind rivals in the past two years.

The company said on Tuesday it had cut total merchandise by about 1 percent in the quarter, as it deals with excess inventory stemming from 2017 when it expected more demand.

The bloated inventory forced the company to unload products to off-price retailers at lower prices, hitting margins in the past several quarters.

But cost cuts and fewer discounts helped boost margins in the third quarter. Gross margins rose for the first time in several quarters - up 20 basis points to 46.5 percent in quarter, beating the average analyst estimate of 45.8 percent.

Cutting back on stocks of materials such as zippers and buttons by as much as 80 percent and shrinking its vendor base by a quarter also helped.

Under Armour said it was in a better inventory position going into the holiday season, and would sell more of its products through its own channels at full price to help improve margins and the brand's image.

"Under Armour continues to make progress on its multi-year restructuring, particularly with regards to inventory and cost reduction efforts," Moody's Apparel Analyst Mike Zuccaro said.

"While some challenges still remain, the company is stabilizing and is better positioned for improvement in 2019."

Though North America sales continued to struggle, the company showed strong growth in its international markets of Europe, Middle East and Africa and Latin America. International sales rose 15 percent, while they fell nearly 2 percent in North America.

The maker of Stephen Curry shoes raised its full-year adjusted earnings per share forecast to between 19 cents and 22 cents from a prior guidance of 16 to 19 cents.

Excluding certain items, it earned 25 cents per share, beating analysts' estimate of 12 cents, according to Refinitiv data.

Under Armour's shares were up 19.4 percent at $20.07, adding to a 26 percent gain this year.

(Reporting by Uday Sampath in Bengaluru; Editing by Arun Koyyur and Saumyadeb Chakrabarty)

By Uday Sampath Kumar