WASHINGTON — Elizabeth Warren, President Barack Obama’s failed nominee to lead the Consumer Financial Protection Bureau, learned something important from her time in Washington: how to run a campaign.

Warren, in the midst of a hotly contested Massachusetts race against Republican incumbent Sen. Scott Brown, has amassed a significant campaign war chest by appealing to grassroots donors, the same kind of people who helped finance Obama’s 2008 run for the presidency. The two candidates are among the nation’s top fundraisers, with a combined total of about $27 million raised between the two of them by the end of March.

Elizabeth Warren, Sen. Scott Brown

The candidates’ spending habits begin to paint a revealing picture.

The most-recent numbers from the Federal Election Commission show Warren spent nearly $5 million on campaign-related finances, with $1.5 million used in Massachusetts. She outspent Brown, who paid out $4.3 million, about half of which was spent in his home state.

Warren is focusing on building her online presence, which means appealing to a national audience of Democrats eager for the party to hold majority control of the Senate.

As the contender, Warren is building “an aggressive field and new media operation,” using social media to create and market a clear image to voters, said Tobe Berkovitz, a Boston University professor of communications who specializes in media strategy.

Berkovitz said Warren typifies the post-Obama approach to elections. “She’s saying she’s running as an unabashed Obama-supporting, strong Democratic voice who will be part of a Democratic Senate,” he said in a phone interview.

Warren raised about $16 million in contributions by the end of the first quarter, of which a significant portion, about $6.7 million, came from unitemized contributions — donations of $200 or less. Small donors make a big difference in Warren’s fundraising efforts, just as they did for Obama and for Massachusetts Gov. Deval Patrick.

Both Brown and Warren are able to spend big because they are raising so much money.

Much of Brown’s money is coming from larger donors. The senator’s campaign collected more than $11 million in contributions by the end of the first quarter of this year, but less than $2 million came from unitemized contributions. A look at his list of contributors shows donations from various company presidents, chairmen and CEOs, as well as risk analysts, fund managers, private-equity managers and brokers.

“He’s popular, but people need a reason to vote for him,” Boston-based political consultant Jim Spencer, president of The Campaign Network, said in a phone interview. “So his job is to get more substantial things in people’s hands to show them that he is of substance, that he has accomplished things and he deserves to be able to keep the job.”

Brown and Warren both run their campaigns like experienced politicians, yet they are relatively new to the Washington scene. This is Brown’s first time running for a full term in office, after winning a special election to fill Sen. Edward Kennedy’s seat in 2010. Warren has never run for office, but she did get a taste of Washington politics when she helped create the CFPB in 2010.

Based on the numbers, the “substantial things” that Brown’s campaign is using to get his message out are hard copies of his accomplishments.

Spending lots of money, in different ways

By the end of March, Brown spent more than $500,000 on traditional forms of campaigning: printing and distributing elections-related materials like letters, fliers and posters. By comparison, Warren spent less than $20,000 on postage and mail. Instead, she spent upwards of half a million dollars nearly six times what Brown spent — on Internet-related efforts to build her website and shape her social media image.

Big-money donors haven’t shied away from Warren’s campaign. Attorneys, educators and physicians are among her top supporters, and they’re giving at the top of legal limits. But she also has the support of self-employed workers, like writers, video producers, artists, game designers, dog walkers — and even a ballroom dance teacher who gives in $20 increments — reflecting her grassroots appeal.

“One of the things that we’ve learned over time about low-dollar Democratic fundraising is that you have to invest a lot to make a lot,” said consultant Spencer, who has 30 years of experience creating persuasion mail for Democratic campaigns.

One thing Warren and Brown have in common is that they invest equally large amounts of money in campaign consulting. Each has spent at least $1 million in fundraising, legal, strategic and financial consulting.

Warren, as a newcomer to the elections scene, also paid for research and Internet consulting to highlight her appeal to traditional liberal activists and “regular people” who are more likely to be swayed by a small show of support. Warren’s website features phrases like “We depend on your support” and requests micro-donations, starting at $5.

Depending on how visitors arrive at their websites, both Warren and Brown have a splash page that appears before the homepage, asking for an email address or donation.

“What every experienced campaigner will tell you is that they’re trying to build the biggest, most engaged list they can have,” said editor of Epolitics.com Colin Delany in a phone interview. The list of names becomes the source of a candidate’s volunteers, donors and voters.

“The common mistakes that you see are people hiding the action buttons, hiding the donate , hiding the ‘get involved’ , hiding the share . And none of these are doing that, these are both very competent sites,” Delany added.

In the end, the race comes down to how much money a candidate has and how the money is spent. “Scott Brown would not be U.S. senator today if that money wouldn’t have come rolling into him,” Spencer said. “You can have the best message, but if you don’t have the money to get that out, it wouldn’t make a difference.”