Germany sold 30-year debt at a negative yield for the first time, as investors desperate for safe assets bet that further falls in yields will boost the value of the bonds in the future.

Investors buying debt at a negative yield get back less than they paid if they hold on until maturity. In Wednesday’s sale, Germany borrowed €824 million ($914 million) through bonds that pay no interest. The bonds were sold slightly above face value, so when they mature in 2050, Germany will pay back €795 million.

Demand...