CJ Nitkowski of Fox Sports 1 first reported the deal.
Detroit will also receive pitcher Alex Wilson and minor league pitcher Gabe Speier in the trade.
A deal involving Cespedes and Porcello has been rumored for several weeks. Earlier this week, it was reported that the two sides could not strike an agreement.
Cespedes, who was traded to Boston from the Oakland Athletics in exchange for pitcher Jon Lester just before the 2014 trade deadline, is scheduled to become a free agent following the 2015 season. The 29-year-old Cespedes, an All-Star last season, batted .260 with 22 home runs and 100 RBIs in 2014.
Porcello, 25, has played with the Tigers for his entire six-year career. Last season, he was 15-13 with a career-low 3.43 ERA.
Detroit's rotation could look a lot different in 2015 than it did last season. In addition to losing Porcello, the Tigers could lose 2013 Cy Young winner Max Scherzer, who is a free agent.
The Tigers finished 90-72 last season, winning the AL Central for the fourth-consecutive season. The Red Sox finished 71-91, last place in the AL East, just one year after winning the 2013 World Series.
- Stanley Kay