U.S. Sen. Ed Markey, D-Mass., waves while boarding his campaign bus at the conclusion of a campaign stop, Tuesday, Sept. 1, 2020, in Boston. Markey, 73, won the Sept. 1 primary against U.S. Rep. Joe Kennedy, D-Mass., for a second full term in the Senate. Credit: Steven Senne | AP

U.S. Sen. Ed Markey, D-Massachusetts, fended off Rep. Joe Kennedy III in the Massachusetts primary election on Tuesday after burnishing his progressive credentials to deal the famed family its first defeat in a congressional election ever in the state.

Markey, who has served in Congress since 1974, won the endorsements of progressives including Sen. Elizabeth Warren, D-Massachusetts, and Rep. Alexandria Ocasio-Cortez, D-New York, and often pointed to his introduction of the Green New Deal in his race against the 39-year-old grandson of Robert F. Kennedy.

The incumbent won 53.8 percent of votes to Kennedy’s 46.2 percent. Decision Desk HQ, the Bangor Daily News’ national election results partner, called the race at 10:13 p.m. on Tuesday.

Kennedy was hoping to become the next member of his family to sit in the U.S. Senate by ousting the 74-year-old Markey, but he often failed to prosecute a cogent case against the incumbent. While the two agree on many policies, each tried to paint the other as out of touch on key issues.

Kennedy went after Markey on the issue of racial inequity, criticizing his initial opposition to school desegregation efforts in Boston in the 1970s and noting criticism of Markey by the father of Danroy “DJ” Henry, a young Black man from Massachusetts killed by police 10 years ago.

Kennedy highlighted his family’s political legacy, in part in response to Markey, who during one debate told Kennedy he should tell his father — former U.S. Rep. Joe Kennedy II — not to help fund a political action committee that was going after Markey.

Markey has portrayed Kennedy as a “progressive in name only,” in one debate faulting him for deciding early in his career to work for a Republican district attorney. He referenced his own family story growing up in working-class Malden, where his father drove a milk truck.

“I could see my mother and father trying to figure out how to pay the bills at the kitchen table,” Markey recalled.

The race has not been cheap, with both candidates raising and spending millions. Early on, Markey and Kennedy were also forced to grapple with the coronavirus, which limited their campaigning. It was a proxy battle of sorts between House Speaker Nancy Pelosi, who backed Kennedy, and progressives including Ocasio-Cortez.

A Kennedy has never lost a race for Congress in Massachusetts. President John F. Kennedy was elected three times to the U.S. House and twice to the U.S. Senate before being elected president. Edward Kennedy was first elected to the U.S. Senate in 1962 and re-elected every six years until he died in 2009. Joe Kennedy ll ran for JFK’s old House seat in 1986, won, and was reelected every election until he opted not to run in 1998.

Nearly 1 million Massachusetts voters already cast their ballots before Election Day, voting early at physical locations or mailing ballots or depositing them in drop boxes due to fears of spreading the virus. Some Democrats worried the race would siphon attention and dollars away from their top goals — defeating President Donald Trump and regaining control of the Senate.

Markey will head into a general election contest in a state that has historically favored Democrats. He will face Kevin O’Connor, a lawyer who beat Shiva Ayyadurai, who ran a failed campaign for Senate in 2018, in a low-key Republican primary decided Tuesday.

In other high-profile Massachusetts races on Tuesday, U.S. Rep. Richard Neal, a Democrat who represents a central part of the state including Worcester and chairs the powerful Ways and Means Committee, beat Holyoke Mayor Alex Morse. A wide-open four-way primary for Kennedy’s seat in southern Massachusetts was not decided by 10 p.m. Tuesday.

Steve LeBlanc of the Associated Press wrote this story. BDN writer Michael Shepherd contributed.