NEW YORK — In a shocking upsest, U.S. Rep. Joseph Crowley, a member of the Democratic House leadership, has been defeated by a 28-year-old challenger, Alexandria Ocasio-Cortez, in the Democratic congressional primary in New York.

"We beat a machine with a movement, and that is what we have done today," said Ocasio-Cortez, a supporter of Sen. Bernie Sanders who has never held elected office and whose candidacy attracted only modest media attention. "Working-class Americans want a clear champion and there is nothing radical about moral clarity in 2018."

Crowley, 56, has been in Congress since 1999 and hadn't faced an opponent in a primary election in 14 years, when the woman who beat him Tuesday was just a teenager. He was considered a candidate to become the next House speaker if Democrats win the majority.

Crowley represents New York's 14th Congressional District, which includes parts of the Bronx and Queens, where he is also the leader of the Queens Democratic party.

Ocasio-Cortez ran a low-budget campaign and was outspent by an 18-1 margin but won the endorsement of some influential groups on the party's far left, including MoveOn.

Born in the Bronx, Ocasio-Cortez said she decided to challenge Crowley to push a more progressive stance on economic and other issues.

She attended Boston University, where she earned degrees in economics and international relations, and also spent time working in the office of the late U.S. Sen. Edward Kennedy.

After graduating, she returned to the Bronx where she became a community organizer. In the 2016 presidential campaign she worked for Sanders.

Among her issues is expanding the Medicare program to people of all ages and abolishing Immigrations and Customs Enforcement. She recently went to Tornillo, Texas, to protest against policies that have separated parents from their children at the southern U.S. border.

Ocasio-Cortez gained some internet attention for a campaign video called "The Courage to Change," a two-minute spot for which she wrote the script and featured footage from her own home.

Crowley, head of the Queens County Democratic Party, is chair of the House Democratic Caucus, the fourth-highest ranking position in Democratic leadership in that chamber of Congress and is among those considered as a possible successor to Rep. Nancy Pelosi as Democratic leader.

During the primary campaign, he touted that experience and support for Democratic Party stances, and as a recognized name and an incumbent, was able to raise significantly more campaign funds than Ocasio-Cortez.

Crowley, who sits on the Committee on Ways and Means, has been a reliable Democratic voice, voting in support of the Affordable Care Act and against attempts to repeal it, as well as voting against GOP-supported tax cuts in 2017. He has also spoken out against President Donald Trump's call to for a wall on the border with Mexico, and Trump's decision to end programs that protected some immigrants from deportation.

The Republican candidate for the office, Anthony Pappas, is running unopposed and had no primary. Pappas teaches economics at St. John's University.