The Red Sox have won five of their last six in a bid to get back in the American League East race. They began the night 5 1/2 games behind both Tampa Bay and the New York Yankees.
Lester (14-8) allowed one run on two hits and worked his way around five walks. He struck out 10. The only run he gave up came in on a wild pitch in the fourth, cutting the Boston lead to 2-1.
Martinez hit a solo homer in the first and Jed Lowrie contributed an RBI single in the fourth. Martinez ran his home run total for the year to 12 with another blast in the seventh to finish the scoring.
Jonathan Papelbon walked two in the ninth but struck out John Jaso looking to end the threat and collect his 33rd save.
The loss went to David Price (15-6), who gave up three runs on 10 hits in seven innings. He fanned eight.