DES MOINES — The Democratic presidential showdown in Iowa between former secretary of state Hillary Clinton and her chief rival, Senator Bernie Sanders of Vermont, yielded a virtual tie, with results too close to call early Tuesday morning.
Clinton led in the earliest results, but that advantage was slowly whittled away throughout the evening as urban precincts reported, and she wound up getting what, at her best, appeared to be a close scare from the insurgent challenger. Supporters in both camps watched live results on their smart-phones and yelled out numbers as they were updated.
With 96 percent of precincts reporting, Clinton had 49.8 percent of the vote and Sanders had 49.6 percent. Martin O’Malley, the former Maryland governor, trailed badly with less than 1 percent and suspended his campaign.
The outcome of the tight race was the first test of whether the outsider energy propelling Sanders’ candidacy was strong enough to stand up to the Democratic establishment forces lined up behind Clinton.
In late evening remarks, his voice scratchy from frantic final days of campaigning, Sanders stood before a boisterous crowd and described his near upset as a victory.
“The people of Iowa have sent a very profound message to the political establishment, the economic establishment, and by the way, the media establishment,’’ Sanders declared. He boasted of an average campaign contribution of just $27, citing it as evidence of his strong grass-roots support.
Shortly before Sanders spoke, his campaign played the Simon and Garfunkel song “America.’’
“This is like the phoenix rising,’’ said RoseAnn DeMoro, executive director of National Nurses United, which runs a super PAC supportive of Sanders’ candidacy. “This is going to be a phenomenon. This is the movement on steroids.’’
Clinton put the best possible face on what appeared to be a tie with the outsider candidate.
“Wow! What a night. An incredible night,’’ Clinton said from her campaign party, standing on stage with her husband, former president Bill Clinton, and their daughter, Chelsea.
“As I stand here tonight, breathing a big sigh of relief, thank you,’’ Clinton said, adding she would keep fighting for the American dream.
Clinton’s supporters filled the Drake University ballroom where she held her election party and chanted “I’m with her’’ and “HRC.’’
A solid win for Clinton would have helped her advance on a track toward the nomination, and a win for Sanders would probably have precipitated worries among party elites that if Clinton isn’t skilled enough to fend off a self-described “democratic socialist,’’ she would be vulnerable against the Republican nominee in November — if she gets that far.
Anecdotal reports suggested a high turnout for the caucuses. On the Drake University campus, more than 200 Democrats mobbed the precinct, overflowing from the lecture hall.
While Republicans down the hall cast their votes via secret ballot and were in and out within an hour, the Democrats had just begun counting and were moving about the crammed room.
The Iowa caucuses weren’t supposed to be this close.
Clinton burst into the race as the prohibitive favorite last April after other high-profile Democrats took a pass on seeking the nomination.
She began vacuuming up cash and endorsements, and — despite faltering over the summer over her use of a private e-mail server as secretary of state — by the fall, she still had a comfortable lead in Iowa.
Though thousands of supporters filled stadiums to see Sanders, for months Clinton refused to even utter his name. Democrats, confident she’d advance, scoffed at the Republican race that was mired in uncertainty as the outsider wing of the party created a media spectacle there.
But in January the Democratic race tightened in Iowa, and some Clinton boosters began worrying she might once again see the nomination slip away, as it did in 2008 against Senator Barack Obama.
Clinton started attacking Sanders and agreed to add more debates to the abbreviated Democratic schedule. The next one is now planned for Thursday in New Hampshire ahead of its primary.
Clinton in recent days began questioning Sanders’ commitment to some of the core issues important to liberals. In her closing TV ad, aired frequently in Iowa, she suggested he would “start over’’ with the Affordable Care Act, add to gridlock in Washington, attack Planned Parenthood, protect the gun lobby, and ignore foreign policy.
She also pushed an argument that Sanders isn’t as prepared as she to lead the country.
“We need a president with the experience to get the job done,’’ the announcer in the spot says, a refrain she repeated in person during many of her rallies here.
On Monday morning, Sanders’ campaign distributed a story from the Wall Street Journal that showed $15 million of the $25 million raised by one of super PACs supporting Clinton came from Wall Street financiers.
Both candidates are well positioned to continue their fight deep into the primary calendar. Clinton raised $37 million in the last three months of 2015, and Sanders pulled in $33 million during that period, according to federal papers released late Sunday night.
Approximately 70 percent of Sanders’ cash came from donations of less than $200, meaning he can continue to tap those donors. Small donors made up 15 percent of Clinton’s haul.
Despite their differences, the two candidates had remarkably similar days in Des Moines on Monday. Both stopped at campaign offices to fire up the troops and then had breakfast with family and top aides.
Clinton arrived at a headquarters with glazed doughnuts and coffee for supporters.
“I had to stop by and tell you how much I appreciate your hard work,’’ she told them. “I thought I’d bring you some unhealthy snacks!’’
Later, she sounded upbeat when she stopped for coffee with her daughter and top aides at the Scenic Route Bakery in Des Moines. “Feeling good,’’ Clinton said nine hours before the caucuses started. “Excellent.’’
Sanders, too, gave a pep talk to supporters at his campaign headquarters, where a worker had baked homemade cookies made in Sanders’ likeness for volunteers.
Then he fueled up with blueberry pancakes with his wife, Jane, and her daughters at Perkins Restaurant and Bakery in Des Moines. He said he would go for a walk in the afternoon, enjoying the unseasonably warm weather ahead of what was predicted to be a nasty storm.
Over the weekend, the campaign became increasingly pointed.
Clinton emphasized her experience at a 1,500-person rally she led in Des Moines late Sunday night.
“Stick with me, stick with a plan, stick with the experience, stick with the ideas that will actually work for our country,’’ said Clinton, her voice growing hoarse as she yelled louder and louder.
Accompanied by her husband and daughter, Clinton promised to rein in Wall Street, even introducing former Massachusetts congressman Barney Frank, who coauthored the famous financial reform legislation known as Dodd-Frank that Republicans threaten to repeal.
“Senator Sanders has been particularly focused on the big banks. I share that,’’ Clinton said. “But here’s what you need to know. We already have the law to do that. That was passed in Dodd-Frank.’’
Sanders has accused Clinton of distorting his record and likes to point out on the stump that he served on the committee that wrote the Affordable Care Act and that his judgment on foreign policy trumps her experience.
He points to his vote against the war in Iraq, a key distinction from Clinton, who voted to authorize force — and now says she regrets it.
Despite earlier promises that Sanders would avoid negative attacks, the Vermont senator launched a negative ad in the final days focusing on Clinton’s ties to Goldman Sachs, a top Wall Street investment bank.
“How does Wall Street get away with it?’’ the announcer asks. “Millions in campaign contributions and speaking fees. Our economy works for Wall Street because it’s rigged by Wall Street.’’
Sunday night, at a rally in Des Moines that also drew about 1,500, Sanders made the familiar pitch for his “radical’’ idea of creating an economy that works for all, not just the 1 percent, by raising the minimum wage to $15, paying women equally to men, and instituting paid family leave.
In addition to ticking off his populist solutions, he singled out Walmart for paying workers so low that they need to rely on government-funded food stamps, health care, and housing subsidies.
“I say to the Walton family: Get off of welfare; pay your workers a living wage,’’ Sanders said.
Annie Linskey can be reached at annie.linskey@globe.com. Follow her on Twitter @annielinskey.