The day after Jim Messina quit his job as White House deputy chief of staff last January, he caught a plane to Los Angeles, paid a brief visit to his girlfriend, and then commenced what may be the highest-wattage crash course in executive management ever undertaken. He was about to begin a new job as Barack Obama’s campaign manager, and being a diligent student with access to some very smart people, he arranged a rolling series of personal seminars with the CEOs and senior executives of companies that included Apple (AAPL), Facebook (FB), Zynga (ZNGA), Google (GOOG), Microsoft (MSFT), Salesforce (CRM), and DreamWorks (DWA). “I went around the country for literally a month of my life interviewing these companies and just talking about organizational growth, emerging technologies, marketing,” he says at Obama’s campaign headquarters in Chicago.

Charles Dharapak/AP Photo

In two long, private conversations, Steve Jobs tore into Messina for all the White House was doing wrong and what it ought to be doing differently, before going on to explain how the campaign could exploit technology in ways that hadn’t been possible before. “Last time you were programming to only a couple of channels,” Jobs told him, meaning the Web and e-mail. “This time, you have to program content to a much wider variety of channels—Facebook, Tumblr, Twitter, YouTube (GOOG), Google—because people are segmented in a very different way than they were four years ago.” When Obama declared for president, the iPhone hadn’t been released. Now, Jobs told him, mobile technology had to be central to the campaign’s effort. “He knew exactly where everything was going,” Messina says. “He explained viral content and how our stuff could break out, how it had to be interesting and clean.”

At DreamWorks Studios, Steven Spielberg spent three hours explaining how to capture an audience’s attention and offered a number of ideas that will be rolled out before Election Day. An early example of Spielberg’s influence is RomneyEconomics.com, a website designed by the Obama team to tell the story—a horror story, by their reckoning—of Mitt Romney’s career at Bain Capital. Afterward, Spielberg insisted that Messina sit down with the DreamWorks marketing team. Hollywood movie studios are expert, as presidential campaigns also must be, at spending huge sums over a few weeks to reach and motivate millions of Americans.

A certain awestruck tone surfaces when Messina talks about these encounters and what they taught him. At 42, he is tall and slightly stooped, with an innocent face, a flop of blonde hair, and a sheepdog friendliness made somewhat surreal by the arsenal of profanity he deploys when not speaking for the record. Messina, who’s from Denver, managed his first campaign as an undergraduate at the University of Montana and in the 20 years since has never lost a race. Before joining Obama in 2008, he alternated between running campaigns and working on Capitol Hill. He made his name as chief of staff to Senator Max Baucus of Montana, becoming known as “Baucus’s muscle” for his skill as a behind-the-scenes enforcer. In 2005 he ran the Democrats’ successful pushback against George W. Bush’s plan to privatize Social Security. “He had a talent for getting K Street to see that it was to their advantage to get on board with whatever Baucus was doing,” says Jim Manley, a former top aide to Senate Majority Leader Harry Reid. At the White House, Messina helped cut the deal with the pharmaceutical industry that cleared the way for the health-care reform law.

Messina is unusual in Washington, at once a hard-bitten political fixer known for handling unpleasant tasks—“In the White House he was given all the, pardon my French, the s–t work,” says Baucus—and also earnestly devoted to self-improvement in a way few Washington operatives would want revealed. A sign on his old computer in Baucus’s office, hung with no evident irony and left there by the staff as a token of fondness, reads, “Be Better Today Than You Were Yesterday.”

Along with his conversations with CEOs, Messina’s regimen for the new job included reading a hundred years’ worth of campaign histories piled on a shelf above his desk. But his obsession runs to the future, not the past, and to business as much as politics. Messina is convinced that modern presidential campaigns are more like fast-growing tech companies than anything found in a history book and his own job like that of the executives who run them. “What they’ve done is more readily applicable to me, because they all started very small and got big very quickly,” he says.

Photograph by Charlie Engman for Bloomberg Businessweek

Messina came to this insight through a relationship with someone keenly attuned to these changes and famous for having groomed two other young men to run a very large enterprise: Eric Schmidt, Google’s executive chairman. Messina considers him a mentor. “Jim and I met in the 2008 campaign and just hit it off on a personal basis,” Schmidt says. “We became very good friends.” Schmidt was an early sounding board and later arranged many of the meetings with CEOs.

Obama can use the help. Reelection campaigns are unglamorous affairs. For many supporters, the thrill of electing him has faded, and the idealism that once vitalized them has given way to disillusionment.

In 2008, Obama’s campaign earned acclaim for using tech to harness, in volunteers and dollars, the excitement surrounding his candidacy. He routed John McCain, outspending him nearly 3 to 1. This race will be different. Romney and his allies are certain to hold the financial upper hand, not least because the Supreme Court’s Citizens United decision in 2010 allowed for a flood of corporate cash. The unspoken hope in Chicago is that superior strategy and a shrewd use of technology can make up for Obama’s diminished stature and more formidable opponent. So Messina has spent 18 months studying and building.

November will be a contest between two different visions of government but also between competing ideas about how to reach voters. Romney’s campaign will take a traditional approach, heavy on television advertising and backed by a massive war chest. Obama’s will rely on organization, scaling up to a national level the type of grass-roots effort Messina once ran for Baucus in Montana. His big bet is that Schmidt, Spielberg, and the rest are right about how far technology has advanced—that it’s come far enough to mitigate Obama’s disadvantages and solve what David Plouffe, the White House adviser who ran the last campaign, calls “our Electoral College Rubik’s Cube.” In that sense, the campaign is about how best to run a large, complex enterprise, while under tremendous pressure and public scrutiny. Messina is wagering Obama’s second term on the idea that the collected wisdom of tech’s biggest titans can outsmart Romney, whose executive savvy has not just made him rich but brought him to the cusp of the presidency.

Presidential campaigns are rarely what they seem. For all that the candidates crisscross the country, offering sweeping national visions and vowing to represent everyone, they really focus on only a handful of states. A campaign manager’s job is to spin the fantasy but not fall for it. The last election was unusual in that Obama really did conduct a national campaign, expand the electorate, and win a broad swath of voters. This election will mark a return to the mean, as is already evident in Obama’s strategy, which aims not to expand the electorate but persuade a sliver of it. Messina is focused on seven states—Florida, Ohio, Virginia, Iowa, North Carolina, Colorado, Nevada—that probably hold the key to the election. Neither the nature of the race nor the means of reaching voters will be quite the same.

Messina often tries to convey this to donors by telling the story of how he came to be campaign manager. It’s December 2010. He’s wading through chest-high surf in Hawaii with the president. Obama summons him over. “I’ve got a favor I want to ask,” he says. “I’d like you to run the reelect.” Messina replies that he’s flattered, but he’ll only take the job on one condition: “You have to understand, this will be nothing like the last campaign.”

“I thought the last one went pretty well.”

“It did. But everything is different now.”

The story is a windup to a sermon Messina likes to give about the importance of technology in reaching voters—a sort of TED talk that echoes a point about which Schmidt, too, is adamant. Last January, as Messina was beginning his new job, Schmidt stepped back from Google and Larry Page took over as CEO. Since then, Schmidt has become a kind of guru to Messina, an executive coach and kindred spirit.

The two became acquainted during the last campaign, just after Hillary Clinton dropped out of the race, when Messina, then Plouffe’s right hand, was preoccupied with ramping up for the general election. “I said to him, ‘You’ve done what I’m being asked to do,’ ” Messina says. “He said, ‘Yes, I have. Let me sit down with you, and we’ll talk.’ For three hours we sat in a conference room, and he just gave me advice about all the mistakes he’d made, about purchasing supply chains, about HR, about the blocking and tackling of growing fast and making sure you have organizational objectives.”

“What I like about Jim,” Schmidt says, “is that he starts the day thinking, ‘What are the analytical measurements that I should make decisions on?’ Many people in politics have no concept of what I just said. They’re intuitive thinkers, and they’re often right. But the difference is that to run a large operation in today’s world, the best way to do it is analytically. And you have the tools now.”

Despite the last campaign’s success using the Internet, Schmidt says the world hadn’t yet reached the point where technology could transform how people run for president. “In 2008 most people didn’t operate on [Facebook and Twitter],” he says. “The difference now is, first and foremost, the growth of Facebook, which is much, much more deeply penetrated into things. The other obvious ones are the growth of YouTube and Twitter. The smart people were using them in 2008; now everyone’s using them. You can imagine the implications of that. You can run political campaigns on the sum of those tools.”

In his memoir of the 2008 election, Plouffe discusses technology’s importance. The 13 million e-mail addresses Obama collected were not just a potent way to raise money but also a valuable means of talking to supporters. “We had essentially created our own television network, only better,” he writes, “because we communicated directly with no filter to what would amount to about 20 percent of the total number of votes we would need to win—a remarkably high percentage.” Both Schmidt and Messina share a fondness for the metrics that highlight these changes: Facebook users have grown tenfold since the last campaign, to more than 900 million. In 2008 most users were in their teens or twenties; the fastest-growing segment now is people over 50. On Election Day, Obama sent two tweets to his 116,000 Twitter followers; today, he has 16 million followers, and his top advisers are all prolific tweeters and minor social media celebrities.

Extrapolating a bit, it’s not hard to imagine the campaign having a direct line to 50 percent or 70 percent—or maybe more—of the voters it will need to win. To reach this expanding universe of potential supporters, the Obama team spent nine months building a platform it calls Dashboard, which allows field staffers and volunteers to access and update the campaign’s voter database from an app on their phones. Canvassers can visit a neighborhood and see which houses are targets and which are a waste of time. Everything is updated in real time—no need to lug around a clipboard or check in at an office. And for voters, no more annoying knocks on the door when they’ve just gotten a phone call or e-mail.

Dashboard is an important component of what the campaign refers to as the “snowflake” model of organizing, the idea that each paid staffer creates and oversees an expanding network of volunteers—a snowflake. Last year, Obama’s fundraisers pushed big donors to contribute the annual maximum of $35,800 right away. This would cover the salary of one paid field staffer, who oversees five unpaid “neighborhood team leaders,” each of whom brings in five team members, who then recruit 20 volunteers apiece. Total: 500 people. The campaign estimates each of the Obama snowflakes will produce an extra 1,000 votes. The earlier they did this, the more voters they would reach. “My advice was to think about it in terms of quarters,” says Schmidt. “You really have six quarters between [last spring] and the election. So essentially all of the key personnel decisions are made in the first quarter. And then you build from there.” As Plouffe put it: “Politics always has room for feel and instinct. But there is so much now that is measurable. We think from a technology and data perspective that what Jim has built will be the best that politics has ever seen.”

Photograph by Charlie Engman for Bloomberg Businessweek

Silicon Valley’s influence is evident even in the layout of the campaign’s headquarters. Designed with input from Facebook executives, the floor plan has few private offices and lots of big, collaborative open spaces where staffers work in pods. This avoids a common Washington problem. The history of American presidential campaigns is full of infighting, hatred, and rivalries. Al Gore’s and Hillary Clinton’s campaigns were riven with factionalism among status-obsessed aides on different floors. Obama’s staff is spread across a single floor—to all outward appearances, happily.

At Schmidt’s suggestion, Messina bypassed the political pros who usually handle campaign technology and opted to build it in-house. “Eric said to me, for a lot of these positions, you don’t want political people,” Messina says. “You need innovators, people who can get stuff done quickly.”

The campaign’s chief technology officer, Harper Reed, is a friendly, bearded startup veteran with gauged earlobes and lots of tattoos, who’d never worked in politics and was brought in from the online T-shirt vendor Threadless.com. “He looks like he’s the heavy-metal lead guitarist in Metallica,” Messina says. “But he’s a genius. He threw out all the old conventional wisdom and said, ‘Show me what you want on a white board. I’ll build it for you.’ ” Under Reed, the Obama team has built systems for registering voters, organizing volunteers, and generally vacuuming up and analyzing every available bit of personal data—not only voting patterns, political contributions, and consumer preferences but also what people read and share, and how they respond to e-mails, ads, tweets, and other solicitations.

At the suggestion of another of Messina’s advisers, Obama-themed merchandise has become a lucrative revenue source. Early on, Messina met, and was dazzled by, Anna Wintour, the editor of Vogue and inspiration for The Devil Wears Prada, who created a spreadsheet to convince him that fashion could generate serious money for the campaign. “What is the one thing everyone has from ’08? A T-shirt,” Messina says.

Wintour drew conservatives’ scorn for appearing in an online video soliciting donors for a fundraising dinner for the first couple with Sarah Jessica Parker. Her influence actually runs much deeper. Last fall the campaign held a runway show in Manhattan to unveil a luxury clothing line by celebrity designers, including Vera Wang and Diane von Furstenberg. Messina, whose own fashion sense borders on the tragic, was introduced on the runway by Scarlett Johansson. Republicans gleefully mock Obama’s designer collection as an exercise in narcissism. (The Romney campaign also sells merchandise, mostly the standard T-shirts, hats, and buttons.) Messina sees only the influx of millions of dollars—although he won’t say how many millions. Sure, the $95 Thakoon Panichgul scarf and $75 Tory Burch tote bag are outlandish, but they net a lot more than $10 Hanes T-shirts. “Raise money, register voters, and persuade voters,” Messina says. “Everything has to feed into those three things.”

Photograph by Charlie Engman for Bloomberg Businessweek

From the outside, it’s not clear that will be enough. On June 7, the Romney campaign said it raised $76 million in May, topping Obama’s $60 million and marking the first time in five years that Obama had been outraised. Despite Spielberg’s input on the Bain ad, elite opinion was that it mostly flopped, after campaign surrogates, including Bill Clinton and Cory Booker, veered off message and commended Romney’s business record, to the delight of Republicans and cable news producers.

Messina is adamant that the Bain attack succeeded among the uncommitted voters he’s concerned with, who ignore pundits and are only now beginning to form opinions of Romney. “When people say, ‘How’s the Bain thing playing?’ it doesn’t matter what the set of Morning Joe has to say about it,” Plouffe says. “But if you’re a 45-year-old swing voter in Toledo, Ohio, what are you seeing? What’s in your local newspaper? What ads are running? And what’s going on in the local field operation? That’s what really matters.” It’s true these voters will probably decide the election. All the technology, money, and management theory really amount to an elaborate, determined effort to discredit Romney and win their support. By virtue of his background, Messina may be especially well suited to that job.

Messina will go a long way to win, as the two leading stories from his Montana career suggest. Both involve the 2002 Senate race he ran for Baucus, a Democrat seeking reelection in a terrible year for Democrats. To protect Baucus, Messina had him refuse to participate in any debate that didn’t also include a fringe third-party candidate who’d inadvertently dyed his skin blue with homemade antibiotics—a guaranteed distraction.

The other story involved his Republican challenger, a state senator named Mike Taylor, who was the target of an ad so devastating it got national attention. The ad charged Taylor with having embezzled student loans from a cosmetology school he’d owned in the 1980s. But its force lay in the music and imagery. Set to a porn soundtrack, it featured snippets of an old television ad for Taylor’s hair salon that showed the candidate clad in a medallioned, open-shirted disco outfit, massaging lotion into another man’s face, and then appearing to reach toward the man’s crotch, as a narrator intoned, “Not the way we do business in Montana.”

“Jim is tough,” Baucus says. “I’ll never forget when he showed me that ad. We were in Bozeman in a motel. The curtains were drawn. He said, ‘Max, what do you think?’ They were afraid I wasn’t going to like it. I loved it!” Humiliated, Taylor quit the race, and Baucus sailed to victory. “I found out quickly from Messina that there was no honor in politics,” Taylor says in an e-mail.

Starting out in Montana provided a broad education in all aspects of a campaign. A rural state with fewer than a million residents, Montana is so cheap even a legislative candidate on a $20,000 budget can run a sophisticated campaign with radio and television ads, direct mail, and phone banks. Districts are small enough that candidates can, and are expected to, knock on every door. Messina became known as a “field guy” for his dogged emphasis on voter contact. “It taught me very early on,” he says, “that you can win if you run good enough grass roots and you’re very clear about the differences with your opponent.”

Because Montana typically votes Republican for president, it’s often regarded as a red state, but it’s almost evenly divided between the parties. “Politics here is competitive,” says Dave Hunter, a local consultant and early mentor to Messina. “Democrats usually perform at around 47 or 48 percent, so candidates have to run a little better campaign than Republicans to win statewide.” The state also lacks a significant minority presence. “We really don’t have African Americans or a Hispanic population,” Hunter says. “You win in Montana by convincing white, independent voters to turn out for you. It’s good experience for presidential politics because it’s not about turning out your base; it’s about persuasion.”

Ten years later, Messina is trying to do the same thing, only at a much higher level. Montana is out of reach. But the seven states he’s targeted, as well as a few more he hopes won’t end up in play, all lie within striking distance of either candidate.

Photograph by Charlie Engman for Bloomberg Businessweek

If the European crisis explodes or an attack on Iran drives up oil prices, the U.S. economy may tank and render moot all of Messina’s careful planning. Or the recovery could pick up steam, or the old gaffe-prone Romney could return and hand Obama an unexpectedly easy win. A likelier scenario, though, is that the race will be close. Messina seems to believe that’s what will happen. “Jim has said to me, ‘This is the most important thing I will do in my lifetime,’ ” says Penny Pritzker, the national finance chair of the last campaign.

Should it come to that, Messina will have a chance to do what every campaign manager dreams of doing, what most Washington operatives brag about doing, but what only an elect few have ever actually done—make the difference in a presidential election. Then, the CEOs will come to him for advice.