A spirited rally is pushing some types of corporate bonds toward their best year in a decade, underscoring investors’ increasing optimism about trade and the economy.

Including price changes and interest payments, U.S. investment-grade corporate bonds have returned 14.2% year-to-date through Monday—on track for their first double-digit tally since 2009, according to Bloomberg Barclays data. Speculative-grade bonds have returned 13.5%.

December...