Tallahassee Mayor Andrew Gillum pulled off a shocking upset in Florida’s Democratic primary for governor Tuesday night, defeating the establishment favorite, Gwen Graham, by a narrow margin of about 40,000 votes.

With nearly all ballots counted, Gillum held a 2.8 percentage point lead over Graham, with 507,000 votes to her 466,000.

Throughout the campaign season, Gillum trailed in the polls behind Graham, a former congressional representative, and Philip Levine, the former mayor of Miami Beach. The Tallahassee mayor saw a surge after a late-stage endorsement from Sen. Bernie Sanders, I-Vt., who traveled to Florida to stump for Gillum earlier this month. As of Monday, Gillum was polling in the No. 2 spot.

His platform includes support for “Medicare for All” and criminal justice reform proposals like the legalization of marijuana; bail reform; and a repeal of Florida’s “Stand Your Ground” law, which gained national infamy after the 2012 killing of Trayvon Martin. He’s also called for injecting $1 billion into public education and hiking the corporate tax rate.

Gillum frequently reminded voters that he was the only non-millionaire running for governor. He was successful in part because of the financial backing of liberal billionaires George Soros and Tom Steyer, who poured more than $1 million into the race through their organizations, the Open Society Foundation and NextGen America, respectively.

Despite that largesse, he was thoroughly outspent in what was an incredibly expensive election. He closed out the campaign with a $4.1 million war chest, compared to Graham’s $7.8 million and Levine’s $31.7 million, according to campaign finance reports.

Graham, a centrist, had the backing of the Democratic establishment. EMILY’s List, which helps elect pro-choice women, infused $1.8 million into her campaign. She had pledged to expand Medicaid and decriminalize the personal possession of marijuana.

Jeff Greene, an eccentric billionaire real estate developer, pumped millions into his own campaign and for a stretch was polling near the top of the pack, but Graham lit into him over his oil and gas investments. The Intercept subsequently reported that he was also a large holder of Puerto Rican debt, an impolitic investment in any Democratic primary, but particularly in Florida.

Gillum has promised to use his platform as governor to advocate for Puerto Rico on the federal level, and push the state to recognize Puerto Rican drivers’ licenses.

Despite the major injections of cash from outside groups, the gubernatorial primary received relatively little national attention. Within Florida, Gillum supporters complained that the local press was not taking his campaign seriously, despite the energy his candidacy generated among young voters.

As the state’s first black nominee for governor, Gillum found substantial support among black voters in the state, specifically targeting black women. “To think about the black vote through women first, he said, opened up progressive possibilities,” the New Yorker wrote of him in a recent profile. “I think you can certainly hedge a lot less when you are talking with black women about issues that have traditionally been a cipher in the black community—L.G.B.T. issues, the environment,” he told the New Yorker.

The state witnessed a major increase in voter turnout. More than 1.4 million total ballots cast in the Democratic primary for governor, as compared to 837,796 votes four years ago. “Andrew was the underdog from the start, but he inspired voters with a bold platform of raising wages, making health care a basic right, legalizing marijuana and fighting climate change,” said Maurice Mitchell, national director of the Working Families Party, which backed Gillum.

Gillum came out on top in the state’s three largest cities, Miami, Orlando, and Tampa. He also won in Tallahassee, which Graham also calls her hometown. His campaign aired its first television ad this month, but he compensated for the lack of exposure by mobilizing an army of volunteers and running a strong ground game to turn out new voters. With a campaign slogan of “Bring it Home,” he spent the last couple weeks criss-crossing the state, making campaign stops in major metropolitan centers, as well as typically overlooked parts of the state.

“We could see the momentum and the energy on the ground for his platform and his candidacy as the only non-millionaire in the race, as the only candidate whose family understood what it was to live paycheck-to-paycheck,” said Andrea Mercado, the executive director of New Florida Vision, a PAC that sought to get out the vote for Gillum in black and Latino communities. “I think it’s a clear mandate that the Democratic Party needs candidates that can connect with voters and that have a whole visionary platform.”

Gillum’s win could put to rest the question of whether the insurgency within the Democratic Party — which already saw Ben Jealous seize the gubernatorial nomination in Maryland, Alexandria Ocasio-Cortez knock off Joe Crowley in New York and a host of other victories — is real.

Gillum’s win is also a boost to Bill Nelson, who is running a lackluster campaign for re-election to the Senate. Gillum’s ability to turn out young voters and people of color could make up for Nelson’s crippling deficit of enthusiasm.

In November, Gillum will face Republican Ron DeSantis, the Donald Trump-endorsed candidate who cruised to an easy victory in his party’s primary. Gillum’s victory in the general election would present a major shift in the state, which has been governed by Republican Rick Scott, a Trump ally now running for U.S. Senate, since 2011.

The attorney general’s race will also be closely watched. State Rep. Sean Shaw won the Democratic nomination for attorney general. His father, Leander Shaw, was the state Supreme Court’s first black chief justice. Shaw was endorsed by former governor and U.S. Sen. Bob Graham, Gwen Graham’s father. He will face off against Ashley Moody, a former circuit court judge in Hillsborough County, which largely comprises Tampa. Moody has been endorsed by Pam Bondi, the state’s current attorney general and another Trump ally.

Top photo: Democratic gubernatorial candidate Andrew Gillum meets with Miami residents on Aug. 13, 2018.