SEN. BECCA RAUSCH of Needham declared victory Tuesday night over Republican Rep. Shawn Dooley in what may have been the most expensive and hard-fought legislative race in the state.

At the time she declared victory, the race was very close but she pulled ahead in the early morning hours of Wednesday, eventually taking a fairly comfortable 55-45 percent lead with 86 percent of the votes counted. Rausch said Dooley did not call to concede, but  she nevertheless claimed the win in what many view as a purple district that became even more purple after redistricting. Dooley declined comment.

The outcome was a harbinger of Republican fortunes on Beacon Hill, at least in the Senate.  Democrats took one seat away from Republicans in the Senate two years ago, leaving the GOP with only three senators, but Republicans did not pick up any seats this year.

Rep. Jacob Oliveira, a Democrat from Ludlow, declared victory over Republican William Johnson of Granby in the race for the seat being vacated by Eric Lesser. Sen. Jason Lewis of Winchester appeared to be holding off a challenge from Republican Edward Dombroski Jr. of Wakefield. Other Democratic senators across the state also held leads over their opponents.

The Rausch-Dooley race featured two big-spending candidates who described each other as extremists. Rausch tried to cast Dooley as a Trump-loving right-winger who was untrustworthy on abortion. Her direct mail advertising called him “the most right-wing politician in the state” and said he was anti-choice, anti-worker, and a two-time Trump voter.

Dooley countered with campaign signs that featured a smiley face and the endorsement of Gov. Charlie Baker. He said he didn’t vote for Trump twice and reminded voters he ran unsuccessfully against Massachusetts Republican Party leader Jim Lyons in a bid to steer the party away from Trump and the right. He suggested Rausch was a disciple of leftists like US Rep. Alexandria Ocasio-Cortez.

At her victory party at The James restaurant in Needham, Rausch had harsh words for Dooley. “This campaign was hard fought,” she said. “We were up against opponents who did not believe in truth or decency, opponents who used almost every dirty tactic in the book against us.”

Asked about the dirty tactics, Rausch did not go into specifics. “My opponent has engaged the entire time in an unethical parade of disinformation about me and my history,” she said.

By contrast, Rausch said her direct mail advertising attacking Dooley was factual. “I don’t believe we sent anything negative. It was honest and truthful,” she said.

“People need to know what our legislative records are,” she said. “He’s trying to talk his way out of his conservative anti-choice record as he runs for higher office.”

The money spent on the campaign was astounding for a Senate race. From the start of the year through the end of October, Dooley’s campaign spent $333,233 and Rausch’s campaign spent $264,533. Rausch said she raised more than $300,000, twice what she gathered in 2018 when she defeated an incumbent Republican to take the seat.

Powerful super PACs also weighed in on both sides. The Massachusetts Teachers Association and 1199 SEIU spent more than $86,000 on behalf of Rausch, while the Massachusetts Majority super PAC, which has ties to Baker, spent $46,245 on Dooley’s behalf.

One curious feature of the campaign was Maura Healey’s refusal to endorse Rausch. CommonWealth in mid-October reported that Healey had endorsed every Democratic senator facing an opponent except Rausch and Sen. Mike Brady of Brockton. Healey’s campaign declined to comment on the non-endorsement.

After the article appeared, Lori Prew of the Committee to Re-elect Mike Brady, said Healey’s campaign reached out to Brady’s campaign to endorse him. “The Healey campaign apologized to the senator as they thought they had already endorsed him,” she said in an email.

Rausch was pressed on the absence of a Healey endorsement at one of her debates with Dooley, but declined to offer an explanation. Dooley, by contrast, said he had a good working relationship with Healey, just as he does with the last two governors – Baker and Democrat Deval Patrick.

“That’s one of the things that differentiates us,” Dooley said, “I think it speaks volumes about what sort of relationship she’ll have with the next administration if and when Maura Healey is our governor.”