Levi's will go public for the second time in the company's history on Thursday. (Spencer Platt/Getty Images)

Levi Strauss made an initial public offering Thursday morning, marking the second Wall Street debut for the iconic jean maker in its 166-year history.

Late Wednesday, Levi’s priced its IPO at $17 per share — higher than the estimated range and valuing the company at $6.6 billion. The stock will trade on the New York Stock Exchange under the LEVI ticker symbol. It roared out of the gate, climbing nearly 32 percent to close trading at $22.41. For one day, the NYSE loosened its dress code so traders could wear denim.

“I’m going to try to not let my emotions run with how the stock price performs every single day," chief executive Chip Bergh said Thursday afternoon. "Obviously I’d rather it be up versus the listing price than down, and it is really positive.”

The company was publicly traded from 1971 until 1985, when it was acquired in a leveraged buyout by the Haas family, which is descended from the company’s namesake founder. Analysts say that the public offering will be a financial boon for the Haas family. Even after the IPO, the company will maintain roughly 80 percent of the voting shares.

Since Bergh took over the company in 2011, Levi’s has overhauled its image. In the past few years, it has dodged threats from athleisure companies and other denim sales. Last year, Levi’s churned $5.6 billion in sales.

But the path has not always been smooth. Analysts said the brand — which credits itself with inventing blue jeans in 1873 — had lost its way by the 2000s. At the time, Levi’s struggled to come up with an answer to why shoppers should turn to it instead of high-end designers that floated on celebrity endorsements and high prices. (Think True Religion, which sold for hundreds of dollars and were paraded around by Britney Spears and Mariah Carey.)

“Consumers never really fell out of love with Levi’s, and no one wanted them to fail,” said Diana Smith, associate director of retail and apparel at the research firm Mintel. “They just forgot about Levi’s because the brand wasn’t giving them a reason to stick around. They lost a decade of consumers.”

That all changed with Bergh’s new vision, Smith said, which focused on making Levi’s a part of modern pop culture. That included partnerships with popular brands like Off-White and Vetements, and making a mark in the sports and music scenes. Levi’s Stadium is home to the National Football League’s San Francisco 49ers, and the company turns out at festivals such as Coachella.

“That’s been a key part of becoming more of a lifestyle brand and resonating with younger consumers,” Smith said.

Any brand has to contend with changing consumer tastes — and especially one that’s 166 years old. So in the last decade, Levi’s changed its tune — rather than refuse to budge from its classic 501s.

“They’re in the fashion space, which is to say they’re rocking and rolling with what customers want, as opposed to saying, ‘This is Levi Strauss. Take it or leave it,’” said Mark Cohen, director of retail studies at Columbia Business School.

Bergh shifted the company’s focus toward female shoppers. Bergh has said that Levi’s average shopper, who used to be a 47-year-old man, is now likely to be a 32-year-old of either gender.

The company has also been a force in political and social debates. In September, Levi’s said it was pledging more than $1 million toward nonprofits and youth activists working to end gun violence. Levi’s also announced plans to join Michael Bloomberg in creating a cohort of business leaders in support of gun control.

Bergh told The Washington Post at the time that it was “inevitable that we’re going to alienate some consumers, but we can no longer sit on the sidelines and remain silent on this issue.”

All told, Bergh’s strategy has responded to changing fashion tastes — and changing views about the world, said Paula Rosenblum, co-founder of Retail Systems Research. That’s been a ticket to millennial shoppers, Rosenblum said, many of whom expect their favorite brands to take cultural issues head-on.

Rosenblum pointed to one of Levi’s recent commercials, called “Circles.” Set to a quick beat, the video shows groups of families and friends from around the world dancing together. Close-ups of jean pants and shorts take a back seat to shots of friends embracing or kicking their legs in the air. The end of the ad flashes the words: “Men, women, young, old, rich, poor, gay, straight,” followed by the tagline, “Let’s live how we dance.”

The ad captures an international — and youthful — embrace for Levi’s, Rosenblum said. Ultimately, Levi’s test has been to hold onto its iconic American roots and stay relevant around the world.

Levi’s is so iconic, Rosenblum said, that when she visited the Soviet Union in the 1970s, passersby on the street would ask whether they could buy her jeans.

“Jeans are a symbol of the coolest part of America,” Rosenblum said. “And Levi’s has positioned itself as the de facto coolest of the cool. You’ve got this American concept of jeans, and then you’ve got the grandpa of jeans, which is Levi Strauss.”