Marty Meehan had been the district's Representative to Congress since 1993. He announced his resignation in May 2007 (effective July 1), allowing him to become the next Chancellor of the University of Massachusetts Lowell. Meehan had last won re-election in 2006, when he ran unopposed. The district was considered to be strongly Democratic, as it voted 58% for the Democratic candidate (John Kerry) in the most recent presidential election. In addition, Massachusetts had not elected a Republican to Congress since Peter Blute and Peter Torkildsen were last elected to office in 1994 (both were defeated in 1996). No Republican had held the 5th congressional district's seat since Paul W. Cronin departed from office in 1975 after his defeat by Democrat Paul Tsongas in 1974.
A primary election was held on September 4, 2007 to determine each political party's nominee for the general election. Niki Tsongas won the Democratic nomination and Jim Ogonowski won the Republican nomination. Tsongas won the general election, held on October 16, 2007, with 51% of the vote; Ogonowski received 45%.