Updated

Long-term Democratic U.S. Rep. Edward Markey beat out Republican newcomer Gabriel Gomez Tuesday in Massachusetts’ special election for John Kerry’s U.S. Senate seat.

Markey had an advantage of about 8 percentage points over Gomez with most precincts reporting late Tuesday, according to unofficial returns. He took to Twitter to thank voters after his victory.

"Thank you Massachusetts!" he tweeted. "I am deeply honored for the opportunity to serve you in the United States Senate."

Gomez said he called Markey to congratulate him and wished him "nothing but the best."

In a concession speech to supporters, Gomez said he was a better person as a result of the campaign and believed Markey would be a better senator having gone through the election.

Gomez said he'd waged the campaign with honor and integrity but was "massively outspent" by Democrats in the five-month election and was facing the might of the national Democratic Party.

Markey outspent Gomez throughout the race, and Republicans were unable to match a well-oiled Democratic field organization in an election that saw relatively light turnout in much of the heavily Democratic state.

Markey’s win helps keep a Democratic majority in the U.S. Senate. Currently, Democrats have a 54-46 majority over their Republican counterparts in the Senate.

A win by Gomez – who was considered an underdog in the race – could have helped the GOP regain control of the Senate during next year’s midterm elections. Despite lofty aspirations by Republicans, a Gomez win was always considered a long-shot.

Markey led the polls much of Monday but said he wasn’t taking anything for granted.

"There is no overconfidence in this entire operation," Markey told reporters after an evening rally in Malden.

Both candidates made a series of stops in their campaigns' final hours, culminating with election eve rallies Monday night, while their staffers cranked up their all-important ground games designed to get as many of their voters to the polls as possible.

On Tuesday, both men voted and reflected briefly on the shortened campaign season. The Senate seat opened when Kerry resigned to become U.S. secretary of state.

Massachusetts State Secretary William Galvin said he expected a lackluster turnout, with no more than 1.6 million of the state's 4.3 million registered voters to cast ballots in the special election, well below the 2.2 million who voted in a 2010 special election, won by Republican Scott Brown, to succeed the late Sen. Edward Kennedy.

Massachusetts polls closed at 8 p.m. EST.

Markey, 66, voted with his wife in his hometown of Malden. He said the length of the campaign didn't prevent him from repeatedly crisscrossing the state and letting voters know what he stands for. He has said his campaign called or rang the doorbells of 3 million prospective voters in the past several days.

"I have delivered a message on gun safety, on a woman's right to choose, on creating more jobs and I think that message has been delivered and I feel very good about today," he said. "And tonight we gonna have a very good night."

Gomez, 47, a political newcomer who worked for a Boston-based private equity firm before jumping into the race, voted in Cohasset, where he lives with his wife and four children. He said he was humbled and proud of the opportunity to vote for himself, saying the election was about choosing the future over the past and what he called Markey's failure to take on the important issues, despite 37 years in office.

"Where I come from, that is mission incomplete," said the former Navy SEAL, adding he was asking for just 17 months, the remainder of Kerry's term.

"Give me a chance to go down there for 17 months and accomplish the mission, which I've done all my life," Gomez said.

In Cambridge, Lori Berenson, 51, said she voted for Markey, mainly because she was skeptical of one of Gomez's main campaign pitches: his request for just 17 months in office.

"He thinks in 17 months he's going to accomplish what Markey hasn't done in 37 years?" she said.

David Wanders, a 43-year-old union member from Stoughton, said he voted for Gomez largely because Markey has been in Washington too long already.

"He's a lifer," said Wanders, an independent. "I don't think he lives here. He lives in Washington."

Wanders, who voted for President Obama in the last election, said nothing in particular attracted him to Gomez.

“What's 17 months going to hurt?" he asked. "If we don't like him, we can get rid of him."

As of 3 p.m. in Boston, 48,868 voters had cast ballots, or about 12.5 percent of the city's eligible voters. That's far less than the 81,882 Boston voters who had cast ballots at the same point in the 2010 special U.S. Senate election.

Markey has held a fundraising advantage throughout the campaign, having spent more $8.6 million on the race through the end of the last reporting period June 5, compared with $2.3 million by Gomez, according to Federal Election Commission records.

Also on the ballot was Richard Heos, who is affiliated with the Twelve Visions Party.

The Associated Press contributed to this report.