What Samsung really needs to beat Apple

FORTUNE — The technology press loves a good narrative. And among the most beloved narratives is a good horserace. Two rivals striving to better each other with new products or new features. The archetypal tech rivalry, between Microsoft and Apple not only lasted for decades, it helped make Silicon Valley what it is today.

During the rise of the smartphone, the great horserace between mobile operating-system makers has been chronicled in great detail. Early leaders like Nokia (NOK) and Blackberry (BBRY) gave up the lead to Apple’s (AAPL) iPhone and Google’s (GOOG) Android. Microsoft (MSFT), meanwhile, struggled mightily just to stay in this race. As that story has grown stale and a little muddled — Android has the bigger market share but Apple has the bigger profits, so who’s really winning? — a new narrative is emerging in the smartphone space. It goes like this: Apple revolutionized and dominated smartphones for five years before iPhone fatigue set in. Now it faces a new contender: Samsung.

But this horserace isn’t about just market share and profits, it’s about capturing consumer love. Samsung may have gained a lot of ground in the mobile market, but it still has a ways to go before its brand can rival Apple. (Unlike Google’s Android, Samsung is an established manufacturer with a consumer brand it spends heavily to support.)

The rise of Samsung as a rival to Apple has been coming for a couple of years, as Samsung emerged as the most successful manufacturer of Android phones. Ad platform Millennial Media tracked mobile-ad impressions from Android-phone manufacturers and found that Samsung devices rose to 46% of total impressions last fall from 23% a year earlier. By that measure, Samsung was stealing share from HTC, Motorola, and LG.

Much of Samsung’s popularity has centered around the Galaxy S series, which has shipped more than 100 million units since the first Galaxy S launched in June 2010. Top Android phones like the Galaxy line have been improving in speed and features. When the iPhone 5 launched last year, many reviewers felt that even though it remained the best smartphone on the market, its competitive edge had eroded.

MORE: 50 greatest business rivalries of all time

This month saw the introduction of the Galaxy S4, which won’t arrive until May but has already received mostly positive “hands-on” reviews. Some speed and performance benchmarks rate it twice as fast as the Galaxy S3 as well as the iPhone 5. Since the S4’s introduction, much of the discussion among tech blogs and financial analysts has centered around this new horse Samsung as it charges on Apple’s heels. Google searches on the Galaxy S4 have already become as frequent as those for the iPhone 5.

Suddenly, many people are taking a closer look at Samsung, which of course is really Samsung Electronics, the flagship subsidiary of the Korean conglomerate active in everything from hotels to life insurance to shipbuilding. Last year, Samsung Electronics made $181 billion (or 201 trillion won) in revenues and $26 billion in operating profit. Apple, by contrast, had $156 billion in revenues and $55 billion in operating profit in its last fiscal year.

A little less than half of Samsung Electronics’ revenues come from its mobility division, which brought in $25 billion in revenues in the most recent quarter, a 58% rise from a year earlier. Mobility is the engine for the company’s overall growth. In the past year, the division has gone from 36% of Samsung Electronics’ revenues to 49%. The mobile division, which also includes tablets and phones like the Note, accounts for 62% of the company’s operating profit.

Samsung’s ascent is remarkable given its humble image even a dozen years ago. The company struggled against onetime electronics giants like Sony (SNE), the premier brand in consumer electronics in the ’80s and ’90s. In contrast to Sony, Samsung had a distinctly un-Japanese spirit of scrappy gumption — its Chairman once burned an entire inventory of defective cell phones in front of the 2,000 factory workers who built them.

Starting off as a maker of cheap air conditioners and low-end TVs, Samsung expanded into chip production until it became the largest maker in DRAM chips as well as an innovator in flash memory chips. Overt the past decade, the company has pushed aggressively into large-screen TVs, flat-panel displays and cell phones — becoming a leading if not the leading manufacturer in each market.

Samsung’s DNA has always been deep in engineering. In a market where there are multiple companies making Android devices, it was that engineering prowess that pushed its smartphones to the head of the pack. In the past decade, Samsung has put an equally strong emphasis on design, which has made it a more prominent brand in the U.S. than any Japanese competitor.

MORE: The ebb and flow of Apple’s billions

Today, it’s not Japanese companies but Apple that is the consumer electronics brand to beat. In recent months, a number of things have taken some of the shine off Apple’s brand: Mishaps like the Apple Maps brouhaha, growing frustration with iCloud, reshuffling of longtime top execs, and the erosion of the iPhone’s competitive edge. A flagging stock price, sagging profit margins, and investor grumpiness around dividends have added to Apple’s public-image troubles.

Not missing its chance, Samsung is stepping in to make Apple’s moment of weakness its own strength. Samsung has shrewdly positioned itself as the Apple alternative, with Galaxy S3 commercials that mock the cultish Apple fanboys who have annoyed so many people over the years. Samsung is nimbly anticipating Apple’s moves: Apple is working on a smart watch? So is Samsung. Apple is producing lower-priced phones and tablets? Get in line, right behind Samsung.

Apple isn’t helping its case either. The company used to hurl snide rebuffs at competitors that stung. But its reply to Samsung’s new rivalry is a page touting the allure of the iPhone brand, and inaccurate comments from a top executive about flaws in the Galaxy S4. That error prompted former Apple exec Jean-Louis Gassée to declare, “Apple has lost control of the narrative; the company has let others define its story.”

Samsung still has its challenges in trying to beat Apple for consumers’ loyalty. Apple has, for now, one strong advantage over Samsung — its distinct brand, which it has built up for decades. Even with its recent troubles, Apple’s brand is substantially more developed than Samsung’s. Interbrand ranked Samsung the No. 9 brand in the world, up from No. 19 three years earlier, but Apple is still ranked No. 2, behind only Coca-Cola (KO).

Being the anti-Apple won’t work for Samsung much longer. The company needs to be seen as more than the maker of the best-engineered Android phone. When brands are most powerful, people attach to them as an expression of their own identities. Judging from the ham-fisted, surreal press event (Tap-dancing kids! Opera gloves! Sideways Mini Coopers!) to introduce the Galaxy S4, Samsung is still struggling to define that image.

It’s not just us in the tech press, consumers in general enjoy a good horserace, especially when they can feel like they’ve picked the winning horse. But what exactly defines this new rival that is threatening to take the lead from Apple? Answering that question is Samsung’s next challenge.

Want more competition, contempt, and all-out conflict? Check out Fortune’s ebook Rivalry, available now, free to subscribers on our tablet apps. Download it for the iPad here.

Subscribe to Well Adjusted, our newsletter full of simple strategies to work smarter and live better, from the Fortune Well team. Sign up today.