By Scott Malone

BOSTON (Reuters) - Veteran Representative Edward Markey of Massachusetts on Tuesday won the U.S. Senate seat vacated by John Kerry and helped Democrats maintain their majority in the chamber.

Markey claimed victory in a post on his official campaign Twitter page, saying: "Thank you Massachusetts! I am deeply honored for the opportunity to serve you in the United States Senate."

Local cable news station NECN said Markey secured 54 percent of the vote with 87 percent of districts reporting.

The win caps a campaign that Markey began in December, shortly after President Barack Obama said he wanted to appoint Kerry U.S. Secretary of State.

Markey ran an aggressive campaign, painting Republican rival Gabriel Gomez, a private equity executive and former Navy SEAL, as out of touch with voters in the liberal-leaning state.

Massachusetts Democrats remembered the lessons of three years ago, when little-known Republican lawmaker Scott Brown won a special election to fill the late Edward Kennedy's Senate seat.

Turnout was low in this off-cycle Senate race, one of two in the United States this year. New Jersey voters in October will pick a successor to Democrat Frank Lautenberg, who died this month.

Democrats have a 54-46 majority over Republicans in the U.S. Senate, a margin that includes the interim Democratic senator appointed by Massachusetts Governor Deval Patrick and the Republican interim senator named by New Jersey Governor Chris Christie.

Both Obama and Vice President Joe Biden traveled to Massachusetts this month to campaign for Markey, who lead in polls throughout the primary and general election campaigns.

Markey was first elected to the House of Representatives in 1976 . He serves as the ranking member of the chamber's Natural Resources Committee and is outspoken on environmental issues.

Gomez, the son of Colombian immigrants and a graduate of Harvard Business School, polled well among Republicans. But that support was not enough to win a majority of voters in the heavily liberal state. This was Gomez's first campaign for statewide office.

Brown lost his re-election bid, in November, to Democrat Elizabeth Warren, a former Harvard professor.

(Editing by Dina Kyriakidou, David Gregorio and Stacey Joyce)