President Barack Obama is stumping for U.S. Senate hopeful Edward Markey in Boston, hoping to give him an edge over Republican Gabriel Gomez in the state's special election.

At a rally in Boston's Roxbury neighborhood, Obama said "nobody is better suited to carry on" the legacy of senators from Massachusetts than Markey, a member of the U.S. House since 1976.

Obama told the thousands attending the rally that he needs Markey in the Senate to fight on issues like gun safety.

The president arrived late Wednesday morning at Logan International Airport, where he was greeted by Markey, Gov. Deval Patrick and Boston Mayor Thomas Menino. They later met with patrons and workers at a sandwich shop in the city's South End.

Gomez was also campaigning Wednesday at a technology round-table in Waltham and veterans event in Chelsea.