Target saw the writing on the fogged-up bathroom mirror.

Its sales of men’s razors and blades, one of the biggest categories in its beauty and personal care aisles, had begun to slip as a number of upstart online brands were disrupting the industry and going straight to consumers, bypassing stores altogether.

Its solution? The Minneapolis-based retailer joined forces with them.

In the past year, Target has partnered with two subscription-based online brands — Harry’s and Bevel — brokering exclusive deals to be the only mass retailer to carry their products.

“It’s been really working so far — knock on wood,” said John Butcher, Target’s senior vice president of beauty merchandising.

Target’s market share in men’s shaving has jumped by double digits, as has its overall sales of men’s razors, he said. About 50 percent of Target’s razor handle sales and about 15 percent of its cartridges now come from Harry’s.

And unlike what some expected, it hasn’t necessarily come at the expense of the longtime king of the razor aisle — Procter & Gamble’s Gillette. Gillette’s sales at Target have also been up, despite losing a bit of shelf space as Target cleaned up the product presentation, Butcher said.

“There were some skeptics out there,” he said. “But the hypothesis was if we become a more meaningful destination for men’s shave, then we get more people in the aisle. And that affords everybody in the aisle the opportunity to win more business at Target. That’s exactly what’s happening.”

Butcher said the alliance with Harry’s and Bevel is one of many ways Target is looking to beef up its offerings for men, who are increasingly shopping for themselves.

“Guys have been underserved,” he said. “We feel like he’s looking for newness and he’s looking for solutions to his modern-day problems.”

While it already sells a ton of men’s underwear, Target also sees some white space when it comes to clothing. So later this year, Target will launch a new in-house men’s apparel brand.

A key ingredient to the partnership with Harry’s has been the eye-popping endcap displays that have been turning the heads of shoppers in a part of the store they were used to just breezing by without much inspiration.

“The test at Target was ‘can we fundamentally alter the retail experience for buying shaving and grooming products and stop people in their tracks for the first time in a long time,’ ” said Jeff Raider, co-CEO of Harry’s. “It’s hard to do that in a small way. You’ve got to go big.”

When it first launched in Target’s 1,800 stores last August, Harry’s displays included larger-than-life 4-foot-tall razors. Earlier this year, those were swapped out for a cutout of a guy in boxer shorts and tube socks standing in front of a mirror with a dog at his feet. It’s been so popular that some customers have tried walking out of the store with it.

Amid the rapid innovation happening in the category, the $2.6 billion men’s shaving industry has been picking up steam over the past several years and grew about 4.4 percent last year, according to Euromonitor.

While the pie has gotten bigger, Gillette has been losing ground. Its marketshare has dropped from 64 percent in 2013 to 54 percent in 2016. Dollar Shave Club, another direct-to-consumer company that sells online subscriptions and was sold to Unilever for $1 billion last year, now has about 8 percent of the market and has surpassed Bic, according to Euromonitor.

Meanwhile, Harry’s, the No. 5 brand, more than doubled its share last year to 4 percent.

The disruption in Target’s shaving aisle highlights the retailer’s increased willingness to make room on its shelves for up-and-coming specialty brands in order to stay relevant, putting the big national brands on notice that they might lose some shelf space, said Carol Spieckerman, a retail consultant.

“Up to this point, there were certain categories that have been sacred spaces for national brands,” said Spieckerman. “You could see this [in men’s shaving] as the first of many more encroachments.”

There’s not much the big brands can do about it.

“A national brand can’t afford to turn down Target’s business,” Spieckerman said. “They just have to get over it.”

It’s also pushed some companies to accelerate their innovation efforts. Gillette launched its own direct-to-consumer subscription service a couple of years ago and has recently cut prices.

“There has always been competition in this category, and we are taking that seriously — in store or with new competitors online,” Gillette spokeswoman Barbara Diecker said in an e-mail. “We continue to focus our efforts on growing in both the traditional and e-commerce spaces.”

While low-priced Harry’s and Dollar Shave Club were created in part because they felt the big brands were overcharging men for razors and blades, Bevel was aimed at addressing the frustrations of men of color who often struggle with razor bumps. Its single-blade system is a much higher-priced, premium product with razors starting at $50.

Target started carrying Bevel in February 2016. This year, it has expanded its presence from 125 to 450 stores. Bevel now also sells its products through Amazon.

“We care about retail in a big way,” Bevel founder Tristan Walker said last month at an industry event in Las Vegas. “The thing that people really don’t understand is retail is an incredibly profitable business. It’s an incredibly predictable business.”

And it’s a rapidly growing part of his business. Retail sales through Target and Amazon made up 10 percent of Bevel’s overall sales last year, but is expected to account for about half of total sales this year, he said.

While its online business was also growing fast, Harry’s executives said customers told them they wanted to be able to pick up replacement blades in a store if they ran out before their next subscription delivery was scheduled to arrive. Target made sense as a retail partner not only because of a shared design and value philosophy, but because about 75 percent of their customers were already Target shoppers.

The Target partnership has also helped Harry’s reach new customers and those who aren’t necessarily interested in subscribing, preferring to try it out first or to buy it when already in the store, Raider said.

He added that while selling at Target hasn’t driven a surge of new online subscriptions to Harry.com, it has helped drive business to Target’s own small, but growing subscription service. Harry’s is the top-selling brand for the service. In fact, Harry’s team has been giving advice and pointers to Target to help improve its subscription business. Raider said he’s not worried about losing out on direct sales as a result.

“It’s got to be right for customers,” he said. “At the end of the day, we put our customers first, our business second. And what that tends to do is drive business.”

After its exclusive agreement with Target expires, Raider said he’s not sure if the brand will expand to other mass retailers.

“For now we’re just focused on trying to make the Target relationship feel really special and learn from it,” he said. “Over time, we’ll be free to do what we want. But that doesn’t necessarily mean that we will. … We don’t see our brand everywhere all at once.”

Harry’s declined to disclose what percentage of its sales now come through Target, but Raider said a “significant majority” of Harry’s business is still through direct sales online.