Ajay Banga loves to talk about the wonders of a cashless society, but every now and then it can backfire. At his first offsite leadership meeting after taking over as president and CEO of MasterCard, he gave his senior team a spirited speech about the downside of cash—it’s hard to track; it’s used for drugs, weapons, and tax evasion; and it’s expensive to make (just the cost to produce and distribute it can run the central bank of an average country up to 1.5% of GDP). As he concluded his remarks, one of the executives in the room, at the Fontainebleau in Miami, challenged Banga to show the group how much cash he had on him. Banga opened his wallet and pulled out $2, at which point the group chided him. “The others basically said, ‘What a cheap guy—he can’t even tip the bellboy,’ ” Banga recalls. “And they were right. I didn’t tip the bellboy!”

Banga espousing the benefits of going cashless is a little bit like Howard Schultz saying everyone should drink coffee—after all, this is a company that makes money on transaction fees every time someone uses credit instead of cash—but Banga is a man on a mission, even if it means coming off as a cheapskate once in a while. These days Banga has a lot to talk about. When he took over MasterCard exactly four years ago, the company had recently gone public, and disrupters like Square and PayPal were starting to make waves in mobile payments. Now the company most people associate with a piece of plastic is going virtual, digital, and biometric. It’s experimenting with facial-recognition software, mobile-payment systems, touchless transactions, and its own idea of a “digital wallet” that it thinks can succeed where others have failed. It is using big data to give its customers better insight, and it has a Google-style moon-shot lab for experimental new ventures. Banga is hardly a native technology CEO—a consumer products lifer, he cut his teeth at Nestlé in India before jumping to PepsiCo’s restaurant division and then to Citibank—but to hear him talk philosophically about a “world beyond cash,” he sounds more like a Silicon Valley futurist than a payment-processing executive.

Welcome to MasterCard 2.0.

Credit cards are a funny business. For one thing, companies like Visa V and MasterCard MA are not technically credit card companies; they’re payment-processing companies, effectively acting as the middleman in the transaction between consumers, merchants, and credit card issuers (typically a bank). Both MasterCard and its rival Visa were in fact once owned by banks: MasterCard by an “association” formed in 1966 that included Wells Fargo WFC , Bank of California, and First National, and Visa by Bank of America BAC (it was originally called the Bank AmeriCard). In 1969 the “Interbank Card,” as it was called, was renamed Master Charge, then MasterCard in 1979. Even after the two went public—MasterCard in 2006, Visa in 2008—they carried their legacies with them; the card brands remained heavily influenced by the banks that had owned them.

Between Visa and MasterCard MA , it’s a two-horse, Coke-and-Pepsi-style race: Visa is the larger of the two, with $11.8 billion in 2013 revenue to MasterCard’s $8.3 billion, and $4.38 trillion in global spending volume to MasterCard’s $3 trillion (American Express is much smaller by that metric, at $940 billion). But while Visa is bigger, MasterCard is growing faster in places like Europe. (American Express has more revenue than either one, at $33.4 billion, but has a different business model.)

Who's in Your Wallet? It's not about how many cardholders, but how much they spend. Below, global purchase volume of the biggest names. Who’s in Your Wallet?
It’s not about how many cardholders, but how much they spend. Above, global purchase volume of the biggest names. —Alexandra Mondalek
Graphic Source: The Nilson Report

Banga faces two big hurdles: to get customers to choose credit over cash, and when they do, to get them to choose MasterCard MA . The first is being helped by a societal trend toward credit over cash (see “The Death of Cash”). The second is more of a challenge when, as even Banga admits, the two brands are interchangeable in consumers’ minds, since both are accepted nearly everywhere. “They’re both ubiquitous,” he says. Banga believes the key to getting consumers to reach for MasterCard instead of Visa lies in offering technology that makes the purchase experience smoother for customers and merchants. And so, from day one, his aim has been to make innovation a priority.

The first thing you notice about Banga, 54, is the thick black beard on his face and the elegant black turban atop his head. The turban is central to Sikhism (Banga was raised Sikh in Pune, India, the son of a retired Indian military general) but is a rare sight in U.S. boardrooms. In a graduation speech at New York University’s Stern School of Business in June, Banga conceded as much: “I tend to stand out in a room,” he said. “Turbans and beards will do that to you.” He joked that being randomly searched at airports is his “part-time hobby.”

The next thing you notice about him is his humor. He teases colleagues and makes fun of himself, frequently; he talks candidly and swears for emphasis. But that frankness and ability to disarm earn him respect. “Ajay is the most intelligent person I’ve worked with in my life,” says one senior colleague who did not want to be quoted for fear of looking obsequious. “It comes down to his confidence; he is deeply at ease with himself.”

When he first joined the company, Banga walked the halls and struck up conversations, asking people who they were and what they did. Employees weren’t used to it. One alum, who worked at MasterCard for more than a decade, says the culture was “extremely conservative” before Banga.

The company’s headquarters in Purchase is a sprawling, 450,000-square-foot building designed by I.M. Pei that MasterCard bought from IBM in 1995. The open hallways, flooded with natural light, are beautiful, but like any corporate campus, spread out and impersonal. That’s changed a little under Banga: the company recently ordered 35 Xootr scooters for the 1,500 employees here to use for getting to meetings; stuffed monkeys hang from trees in the “conversation suite,” a new interactive social media center. And of course, at the cafeteria and at various coffee carts, only MasterCard is accepted—no cash.

Credit card processors are in a way the original technology plays; MasterCard’s core competency, after all, has always been the technology infrastructure that connects more than 25,000 banks to 2 billion cards that are used at 40 million merchants in 210 countries. But Banga doubled down on technology. He launched an in-house innovation arm, MasterCard Labs, in 2010 when he was still COO. PayPass, its contactless technology, was rolled out in 2012 and is now used by more than 2 million merchants in 63 countries. MasterPass, the company’s digital wallet (it stores your personal data to more quickly complete a purchase from any device, using any brand of card) followed, in February 2013. And while digital wallets have had questionable success—Google Wallet, Square Wallet, and Visa’s original digital offering, V.me, all failed to gain traction—MasterCard is making MasterPass its biggest digital push yet, with constant product updates and, as of this month, the ability to purchase from within apps rather than just at mobile websites. To win in the digital payments market, “you have to have some basic capability in the physical world and some capability in the digital world,” says Ed Olebe, who worked in emerging payments at MasterCard and left this year to start his own mobile commerce company. “And what a lot of these smaller, newer companies find is that it’s very hard to make a dent in the physical world. The players who can handle the digital challenges and the security challenges, and keep a presence in the physical world, will win. And that’s MasterCard.”

To run MasterCard Labs, Banga tapped Garry Lyons, a 42-year-old Irishman who came in as part of the acquisition of Orbiscom, a Dublin-based maker of payment-solution software the company bought in 2009. Banga gave him a long leash: “Garry is geeky—it’s like he’s got ADD,” Banga says. “I told him, ‘Here’s the money. Knock yourself out. Waste it. Buy booze if you like. I don’t care. But if you don’t give me stuff to launch, I’ll fire you all.’” Last year, Lyons held an “innovation express,” where he put a group of his techies in a hotel room for 48 hours and told them to create a new product. One product from MasterCard Labs is ShopThis!, which lets customers purchase items from within a magazine app—click on an ad for cologne, for example, and buy it right there. Banga also made Lyons, seen as a star within the company, MasterCard’s chief innovation officer. Lyons says it’s a comfort to have a CEO who is committed to technology: “We have the right guy driving the bus.”

Ajay Banga MasterCard CEO Ajay Banga stands in the atrium of the company’s headquarters in Purchase, New York.Photograph by Mackenzie Stroh for Fortune

Ask Banga what other technologies MasterCard has up its sleeve and he offers a string of examples, some of them apps, some just small features that bring big convenience. He loves inControl, which lets you carry just one MasterCard but set it to charge either your credit or debit account for purchases above or below an amount you choose. It can also work like parental controls on a television, restricting the type of store where the card can be used. Or, Banga points out, it can help curb your Starbucks addiction: Set it to limit your spending there each month to, say, $50, and “at $45 it’ll send you a text and say, ‘Hey, dopey guy, you’ve reached $45. Next time you go, what do you want me to do?’ ” That all may sound pretty simplistic, but it’s something MasterCard has patent-protected for the next 10 years.

Other innovations are in play overseas: The company is working with governments in countries like South Africa to issue cards that contain biometric data. It has ramped up fraud protection in the wake of the 2013 Target breach (as have all its competitors). And it is starting to use big data to enhance existing services, most notably for its small-business customers. Its Market Vision reports now tell small businesses how they’re doing as compared with an aggregate of similar competitors in the area.

Analysts say Banga is succeeding in his mission. “There are many times where I see MasterCard make headlines first,” says Barclays analyst Darrin Peller, who rates the stock a buy. “I think that’s their culture now. They are trying to be extraordinarily innovative.” The stock is up nearly 30% over the past year, compared with the S&P’s gain of 17%. In the past five years it’s risen 330%. Visa has climbed 240% in the same time.

Much of the opportunity for the company is in parts of the world where a digital wallet is still decades away. It is zeroing in on the 2.5 billion people in the world who are unbanked or “underbanked.” (Banga co-chairs the World Economic Forum’s financial steering committee.) In Lebanon and Jordan it partnered with the UN World Food Programme to give Syrian refugees ­MasterCards loaded with $27 per week for food. In political crisis zones like Russia and Egypt, many government employees get their salaries on prepaid MasterCards. When chaos hits, banking systems freeze, and cash becomes unavailable, their cards are still automatically refilled.

Of course, MasterCard’s competitors are pushing innovation hard too. Last month Visa announced an ambitious digital venture, Visa Checkout. AmEx recently hired a former PayPal executive as its CTO, while PayPal has made its payment technology available in brick-and-mortar stores through a partnership with Discover. Bitcoin continues to gain momentum, and Apple is rumored to be working on a digital wallet. (It filed an “iMoney” patent in January.)

Despite all this, and for all Banga’s talk about a cashless future, the vast majority of the world’s transactions—some 85%—are still conducted in cash. If anything, the argument could be made that the long-heralded end of cash has been overhyped and is still many years away. Ann Cairns, MasterCard’s head of international markets, offers a more cautious take: “There is going to be a continuum where cash, cards, and mobile exist side by side for a significant period of years,” she says.

However long the transition takes, with Banga’s eye trained on technology, MasterCard looks well positioned to lead in a post-cash world. Maybe he can even find a solution for tipping those bellmen.

A shorter version of this story ran in the August 11, 2014 issue of Fortune.