By Beth Kowitt, writer

FORTUNE — When Google GOOG acquired a tiny wireless startup called Android in 2005, few

at the search giant had particularly high hopes for the deal — if they even knew about it. At that point Google had purchased just a handful of companies, mostly software makers it had quietly folded into its operations. (Big, high-profile deals like YouTube and DoubleClick came later.) Besides, not many people knew exactly what Android did: The upstart was in stealth mode, and co-founder Andy Rubin, best known for creating the Sidekick mobile device, said little about its product or mission. Executive chairman Eric Schmidt would later joke that he scarcely noticed when Google founders Larry Page and Sergey Brin bought the company.

Today, of course, Android is impossible to ignore. It is the mobile operating system — the brains of a cellphone — that powers more than 100 million gadgets. (That number will be out of date by the time you read this: Every day another 400,000 Android devices are activated.) Apple’s AAPL iPhone gets credit for showing consumers just how cool and powerful a mobile device could be, but Google democratized smartphones by making Android available free to any handset maker that wanted to use the platform. At last count, Android software was on more than 300 different phones and tablets around the world. The only smartphones that use the iPhone operating system? iPhones. “If you just plot the graph looking at how quickly we grew,” says Rubin, now senior vice president of mobile at Google, “it’s almost vertical.”

There’s a lot of (justifiable) chest beating over Android at Google these days — a corporate development VP has called the Android acquisition Google’s “best deal ever” — but in hindsight the overwhelming success of Android is kind of a miracle. Big tech companies screw up many if not most of their acquisitions, letting them wither from corporate neglect or driving out founders and other talent with their inflexible cultures and protocols. (Skype buyer Microsoft MSFT , are you listening?) Even Google can be guilty of this too (dMarc, Dodgeball), but its management of Android is a textbook example of a deal gone terribly right: Rubin and his team thrived in Google’s engineering-driven culture, which encouraged innovation by letting Android release less-than-perfect versions that it would continually upgrade. Google also embraced Rubin’s vision of giving the operating system away — a gambit, enabled by Google’s broader ad-based business model, that stoked adoption of the platform.

But Android ultimately triumphed thanks in large part to its corporate benefactors: Google co-founders Page and Brin saw the broader potential of Android almost from the outset. For the young entrepreneurs Android was more than just another software acquisition. It was the centerpiece of their grand vision to transform the telecommunications industry and make it more open and accessible — in short, more like the Internet.

Google on the go

Brin and Page weren’t being purely altruistic in their push for a more open, wireless web. They and other executives at the company saw the data: Back in 2005 there were about 2 billion mobile handsets (today that number is closer to 5 billion), compared with fewer than 1 billion PCs, according to research firm Gartner. You didn’t have to have the IQ of a Google engineer to figure out that mobile was the next frontier. Google, which makes a business of capturing eyeballs and delivering relevant advertisements, would have to move alongside consumers as they migrated to phones from desktops. But how?

Until the arrival of the iPhone in 2007, cellphones were in the dark ages. Flip phones like Motorola’s MMI RAZR were all the rage, and consumers could access only limited snippets of information, usually by navigating a complex set of menus, or decks, provided by the phone companies and their handpicked partners. But Brin and Page weren’t satisfied to be a supplier to the telcos. They wanted to find a way to wrest control from the network operators so that consumers could use their phones to pluck information from the Internet, just as they did on their desktops.

Android co-founder Andy Rubin

Andy Rubin shared this vision. Rubin, 48, spent part of his career at Apple, where engineers measured success by a product’s mass adoption. Danger, the Sidekick-maker he’d co-founded in 1999, had sold millions of devices. (Microsoft bought Danger in 2008.) For his next act Rubin wanted to reach hundreds of millions of users. Rubin, who had met Page (a Sidekick user) during a talk Rubin had given at Stanford, asked if they could meet to discuss his latest venture. When Rubin explained that his new startup Android would build an open operating system that anyone could use, and that he intended to give it away, Page was smitten. “The vision was almost ridiculously ambitious, which Larry and Sergey love,” says Alan Eustace, Google’s senior vice president of knowledge. Brin and Page personally green-lighted the acquisition for an estimated $50 million.

Though Rubin had a track record of success and support from the top, he nonetheless had to prove himself at Google. “When you don’t ship anything, you’re nobody,” he says. “We would have all these meetings, which were strategy meetings, and [Schmidt] would look at me after I’d made some speech across the table, and he’d say, ‘Andy, you have zero market share. You haven’t launched yet.’ ” In fact, it took Rubin and his team almost three years of incubation at Google to get Android into the market. David Lawee, vice president of corporate development at Google, once admitted that he had his concerns: “I saw this guy in my building for two years, walking his dog, and I was like, ‘I hope this guy does something.’ ”

Building 44, home of the Android team, is a hive of activity. (Visitors to the Googleplex may know it better as the building with all the statues of desserts out front; the team names different versions of Android after treats — Cupcake, Éclair, Donut, etc.) Rubin says that he’s been offered space in bigger and fancier buildings, but he wants to maintain a startup mentality, and in fact, Android engineers still work long hours continually updating the software. To lure people to the office on the weekends the staff instituted Bacon Sundays.

The Android lab remains off-limits to anyone besides key engineers and a handful of executives. When I visited Rubin, I was steered past ominous red signs declaring no visitors beyond this point into a nondescript conference room. I had seen him interviewed onstage the night before, and Rubin seemed much more comfortable here in front of an audience of one. Zarko Draganic, who worked with Rubin at Apple and at General Magic, an Apple spinoff, in the mid-1990s, says it amazes him how often Rubin is in the public eye — keynote speeches and interviews — considering how introverted he is.

Rubin has a reputation at Google for being self-assured, but he tells me he never thought Android’s meteoric rise at Google was a slam-dunk. At one point, he says, he fretted he wouldn’t get the resources and support he needed. Instead, his team grew from eight employees in 2005 to 79 engineers by the time Google released the first version of Android in 2008.

Taking off 

Android could not have landed at a better time for the wireless industry. The iPhone was a hit, but no other handset maker could license Apple’s operating system. Ditto RIM’s RIMM BlackBerry platform. The other options, Nokia’s NOK Symbian and Microsoft’s version of Windows for phones, just weren’t up to snuff. Android had the capabilities and flexibility handset makers wanted, and the price — free — was right. (From the start Google had made the decision to give away Android and the software development kit to app makers, on the theory that it could more than recoup its investment by boosting ad sales tied to mobile search.)

Motorola Mobility CEO Sanjay Jha emerged as one of Android’s biggest cheerleaders, ditching all other smartphone platforms at Motorola in favor of Rubin’s software. (For more on Motorola, see “Leadership Q&A.”) HTC launched the first Android phone, and Samsung, LG LG , and others followed suit. Carriers that didn’t have the iPhone (at the time this included Verizon VZ ) were delighted as well. Suddenly they too had a chance to offer slick multimedia phones with a growing library of apps, but they also had the ability to customize devices — loading them with their own apps, for example — in ways that Apple would never allow. Though T-Mobile marketing chief Cole Brodman admits he wouldn’t turn down the chance to offer iPhones on his network, he says, “We wouldn’t be able to do much other than distribute it.” It’s little wonder that at the end of the first quarter, Android had a 35% share of new smartphone shipments, research firm Canalys says, having surpassed Nokia’s Symbian as the most-shipped smartphone platform.

Stacking Up: How Android compares to other companies' smartphone operating systems.

But are handset makers striking a deal with the devil by teaming up with Google? As phones simply turn into vessels for housing apps and accessing the web, it becomes harder to differentiate among these various black boxes with touchscreens. Consider what happened to PC makers like Dell DELL , which all ran Microsoft’s software and ended up competing on price because their hardware wasn’t sufficiently unique. With Android, handset makers run the risk of being “Delled,” says consultant Ted Shelton, referring to how Dell epitomizes the low-margin PC business. Handset makers insist they still add value, layering their own user interfaces on top of the software — HTC Sense or Motorola’s Motoblur — so that each brand has its own flavor.

Android has worked out spectacularly well for Google, even though the open-source platform doesn’t produce any direct revenue. “This is not philanthropy,” former Google executive Jonathan Rosenberg said in a 2010 earnings call. “When the web is better, more people use it more often, and that means they search more often.”

Rosenberg’s comments would seem to reinforce a common knock on Google, that it is a one-trick pony, focused entirely on search. But, oh, what a pony it is! Search remains a very healthy business, and with Android, Google has successfully helped move the game to mobile: During its fourth quarter 2010 earnings call, Google reported that mobile search grew four times on devices with full web browsers in 2010, and search volume from Android devices was up 10 times year over year. The increase has obviously been driven by the sheer jump in users carrying Android phones, but Google has also said that Android users search twice as often as people with other smartphones. That’s by design. Android device makers often build a search button into the hardware, and most users can find a search widget on the home screen. But Rubin says Android phones in general are more integrated with people’s lives. “That pervasiveness pays off on people doing more searches, but people do more of everything,” he adds.

Although Google doesn’t break out Android specifically, Rubin says Android is profitable and cash-flow positive, and it’s all through ads. Piper Jaffray estimates that Android pulled in $133 million in revenue in 2010, and that number could swell to $1.3 billion in 2012 as marketers pay more to reach consumers on devices that are with them at all times — and can deliver ads based on the user’s location. On top of that Google could add a revenue-producing mobile-payment service, such as its Google Wallet app, or a media hub such as iTunes. Schmidt has suggested that Android could at some point be a $10-billion-a-year business. Not a bad chunk of money for a company that analysts estimate will pull in almost $28 billion in revenue this year.

Branching out, staying hip

For some consumers the Android brand has surpassed Google in coolness. Google is corporate (though new CEO Larry Page aims to make the company more like a startup); Android’s image is edgy and youthful. The iPhone remains the BMW of the market, with about 14% of the global smartphone base at the end of 2010, according to Canalys. But clearly not everyone wants or can afford a luxury set of wheels. Eustace notes that China has 440 million Internet users, and 300 million of those are on mobile. This untapped low-end smartphone segment is key for the company, especially in emerging markets where mobile devices may be the only channel to Internet access. By using Android, Rubin says, handset makers can save about 20% on the cost of a phone’s building materials.

Google’s competitors have taken notice. Oracle ORCL is suing Google, claiming Android infringes patents held by its Sun unit. HP in 2010 acquired device maker Palm and is planning to use its webOS in its new tablet. Nokia earlier this year contemplated replacing its Symbian platform with Android in most smartphones, but instead teamed up with Microsoft, whose revamped Windows Phone 7 is a big improvement over previous versions. And another rival has stealthily crept up: Google’s own Chrome operating system. (Google also has a web browser named Chrome, but they are separate products. No one ever said Google was great at marketing.) The Chrome operating platform is Google’s answer to Windows, a homegrown computer management system that many believed would reside on PCs and laptops. Lately, though, many analysts say the lines are blurring, and that Chrome could pop up on tablets and other next-generation mobile devices.

Depending on how you look at it, the Android-Chrome standoff is either an example of what makes Google great (lots of experimentation, and may the best product win) or unfocused (why not just invest in making one great platform?). As he tries to bring Google, which now has more than 26,000 employees and a sprawling array of projects, back to its entrepreneurial roots, Page may have to refine the company’s culture and figure out, for example, if he wants to keep his engineers working on multiple projects or if there’s a benefit to streamlining. The stuff he shouldn’t jettison? The passion and creativity that helped bring Android to market.